RE: BUG #17326: Postgres crashed when pg_reload_conf() with ssl certificate parameters

From: "James Pang (chaolpan)" <chaolpan(at)cisco(dot)com>
To: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: RE: BUG #17326: Postgres crashed when pg_reload_conf() with ssl certificate parameters
Date: 2021-12-13 07:06:16
Message-ID: PH0PR11MB51910828B552926204514891D6749@PH0PR11MB5191.namprd11.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

1. gdb attache postgres
]# ps -ef | grep postgres
postgres 8790 1 4 06:53 ? 00:00:00 /usr/pgsql-13/bin/postgres
# gdb -p 8790
...
Attaching to process 8790
Reading symbols from /usr/pgsql-13/bin/postgres...Reading symbols from .gnu_debugdata for /usr/pgsql-13/bin/postgres...(no debuggin g symbols found)...done.

2. start another psql session to run pg_reload_conf()
jamet=# select pg_reload_conf();
pg_reload_conf
----------------
t
(1 row)

Edit postgresql.conf to change ssl_certificate parameter ,

3. (gdb) cont
Continuing.
[Detaching after fork from child process 8828]

Program received signal SIGHUP, Hangup.
0x00007ff49879d25b in select () from /lib64/libc.so.6
(gdb) cont
Continuing.

4. psql session run pg_reload_conf again
$ psql
select pg_reload_conf();

5. gdb receive SEGSEGV
(gdb) cont
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x00007ff49a2fe094 in asn1_string_embed_free () from /lib64/libcrypto.so.1.1
(gdb) bt
#0 0x00007ff49a2fe094 in asn1_string_embed_free () from /lib64/libcrypto.so.1.1
#1 0x00007ff49a30824f in asn1_primitive_free.localalias () from /lib64/libcrypto.so.1.1
#2 0x00007ff49a3086b8 in asn1_template_free () from /lib64/libcrypto.so.1.1
#3 0x00007ff49a308376 in asn1_item_embed_free () from /lib64/libcrypto.so.1.1
#4 0x00007ff49a3086b8 in asn1_template_free () from /lib64/libcrypto.so.1.1
#5 0x00007ff49a308376 in asn1_item_embed_free () from /lib64/libcrypto.so.1.1
#6 0x00007ff49a3086b8 in asn1_template_free () from /lib64/libcrypto.so.1.1
#7 0x00007ff49a308376 in asn1_item_embed_free () from /lib64/libcrypto.so.1.1
#8 0x00007ff49a3085d9 in ASN1_item_free () from /lib64/libcrypto.so.1.1
#9 0x00007ff49a78059c in ssl_cert_clear_certs () from /lib64/libssl.so.1.1
#10 0x00007ff49a780645 in ssl_cert_free () from /lib64/libssl.so.1.1
#11 0x00007ff49a78a25c in SSL_CTX_free () from /lib64/libssl.so.1.1
#12 0x000000000068b6b8 in be_tls_init ()
#13 0x00000000007271e1 in SIGHUP_handler ()
#14 <signal handler called>
#15 0x00007ff49879d25b in select () from /lib64/libc.so.6
#16 0x000000000072a20c in ServerLoop ()
#17 0x000000000072bd10 in PostmasterMain ()
#18 0x00000000004869a0 in main ()
(gdb) cont
Continuing.

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.

Thanks,

James
-----Original Message-----
From: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
Sent: Friday, December 10, 2021 10:23 PM
To: James Pang (chaolpan) <chaolpan(at)cisco(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17326: Postgres crashed when pg_reload_conf() with ssl certificate parameters

> On Fri, Dec 10, 2021 at 09:05:19AM +0000, James Pang (chaolpan) wrote:
> try to install debug_info and get stack, 1. use coredump , ]$ gdb -q
> -c /pgdata/core.1317550.sig11.1639122870s /usr/pgsql-13/bin/postgres
> Reading symbols from /usr/pgsql-13/bin/postgres...Reading symbols from .gnu_debugdata for /usr/pgsql-13/bin/postgres...(no debugging symbols found)...done.
> (no debugging symbols found)...done.
>
> warning: Can't open file (null) during file-backed mapping note
> processing
>
> warning: Can't open file (null) during file-backed mapping note
> processing
>
> warning: Can't open file (null) during file-backed mapping note
> processing [New LWP 1317550] [Thread debugging using libthread_db
> enabled] Using host libthread_db library "/lib64/libthread_db.so.1".
> Core was generated by `/usr/pgsql-13/bin/postgres'.
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0 0x00007f72e3290094 in asn1_string_embed_free () from
> /lib64/libcrypto.so.1.1
>
> 2. when gdb log ,
> Program received signal SIGHUP, Hangup.
> 0x00007f4fb438e25b in select () from /lib64/libc.so.6 Continuing.
>
> Program received signal SIGHUP, Hangup.
> 0x00007f4fb438e25b in select () from /lib64/libc.so.6 Continuing.
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00007f4fb5eef094 in asn1_string_embed_free () from
> /lib64/libcrypto.so.1.1 Continuing.
>
> Program terminated with signal SIGSEGV, Segmentation fault.
> The program no longer exists.
>
> Should I install debug info for set_user module too?

Eventually yes, but judging from the logs you've posted ("/usr/pgsql-13/bin/postgres...(no debugging symbols found)") the debugging symbols for postgres itself are not there yet. Do you get a meaningful stack trace from the coredump with the `bt` command right now?

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kyotaro Horiguchi 2021-12-13 07:33:05 Re: BUG #17334: Assert failed inside computeDistance() on gist index scanning
Previous Message Kyotaro Horiguchi 2021-12-13 05:44:42 Re: BUG #17327: Postgres server does not correctly emit error for max_slot_wal_keep_size being breached