Bug 257323 - databases/postgresql13-server: on 14-CURRENT/KTLS: Segmentation fault
Summary: databases/postgresql13-server: on 14-CURRENT/KTLS: Segmentation fault
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: pgsql
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-22 06:19 UTC by O. Hartmann
Modified: 2021-07-27 07:24 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (pgsql)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2021-07-22 06:19:11 UTC
The host is running 14-CURRENT (FreeBSD 14.0-CURRENT #109 main-n248146-5ab82b00cca: Thu Jul 22 04:53:13 CEST 2021 amd64), KTLS is enabled. The host gets upgraded on a daily basis. 
The ports tree is also updated on a daily basis, databases/postgresql13-{server|client} has been recompiled recently via "portmaster -df" to ensure non-out-of-sync code with the base system.

The problem: No other connections to the server but via socket are possible. Any connection via local socket is possible in any fashion (trust, md5 or scram-sha-256 hashed passwords).
No TCP connection of any kind is possible: nor 127.0.0.1, ::1 or any remote IPv4 or IPv6 connection to this host.
In postgresql's log the only entry, whatever loglevel is used, is:
2021-07-22 08:01:57.522 CEST [68352] LOG:  connection received: host=localhost port=30235
In this case it is a connection attempt of a local service via "localhost", but one can replace this log entry's host= with any FQDN hostname or IPv4/IPv6 address. Nothing further is logged then.

On the client side, I get this message from the psql client when attempting to connect via TCP to the server:

psql: error: server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.


Sometimes I'm lucky and the postgresql server dumps a core, without terminating the whole postgresql service on the host.
A first investigation of the coredump with gdb and a backtrace seems to confirm the problem with KTLS:

Reading symbols from /usr/local/bin/postgres...
(No debugging symbols found in /usr/local/bin/postgres)
[New LWP 252697]

warning: .dynamic section for "/lib/libc.so.7" is not at the expected address (wrong library or version mismatch?)
Core was generated by `/usr/local/bin/postgres -D /pool/datenbank/postgres/walstatt'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00000000006ae464 in secure_raw_write ()
(gdb) bt
#0  0x00000000006ae464 in secure_raw_write ()
#1  0x00000000006bab45 in ?? ()
#2  0x0000000800daeac0 in ?? () from /lib/libcrypto.so.111
#3  0x0000000800dadc79 in ?? () from /lib/libcrypto.so.111
#4  0x0000000800dadb76 in BIO_write () from /lib/libcrypto.so.111
#5  0x0000000800dabecb in ?? () from /lib/libcrypto.so.111
#6  0x0000000800dae2a8 in BIO_ctrl () from /lib/libcrypto.so.111
#7  0x0000000800c39b36 in ?? () from /usr/lib/libssl.so.111
#8  0x0000000800c46b47 in ?? () from /usr/lib/libssl.so.111
#9  0x0000000800c391c7 in ?? () from /usr/lib/libssl.so.111
#10 0x00000000006b9c19 in be_tls_open_server ()
#11 0x00000000006ae0bf in secure_open_server ()
#12 0x000000000075cc2f in ?? ()
#13 0x000000000075c375 in ?? ()
#14 0x000000000075bd13 in ?? ()
#15 0x000000000075910c in PostmasterMain ()
#16 0x00000000006bbd2c in main ()
(gdb) 


I haven't enabled debugging on postgresql so far. Another server is also running 14-CURRENT with KTLS enabled, but running postgresql12-server - _without_ problems.