Re: Support for NSS as a libpq TLS backend
Daniel Gustafsson <daniel@yesql.se>
From: Daniel Gustafsson <daniel@yesql.se>
To: Rachel Heaton <rachelmheaton@gmail.com>
Cc: "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>,
Michael Paquier <michael@paquier.xyz>,
Jacob Champion <pchampion@vmware.com>,
"hlinnaka@iki.fi" <hlinnaka@iki.fi>,
"andrew.dunstan@2ndquadrant.com" <andrew.dunstan@2ndquadrant.com>,
"andres@anarazel.de" <andres@anarazel.de>,
"thomas.munro@gmail.com" <thomas.munro@gmail.com>,
"sfrost@snowman.net" <sfrost@snowman.net>
Date: 2021-09-30T12:17:29Z
Lists: pgsql-hackers
Attachments
- v44-0001-nss-Support-libnss-as-TLS-library-in-libpq.patch (application/octet-stream) patch v44-0001
- v44-0002-Refactor-SSL-testharness-for-multiple-library.patch (application/octet-stream) patch v44-0002
- v44-0003-nss-Add-NSS-specific-tests.patch (application/octet-stream) patch v44-0003
- v44-0004-test-check-for-empty-stderr-during-connect_ok.patch (application/octet-stream) patch v44-0004
- v44-0005-nss-pg_strong_random-support.patch (application/octet-stream) patch v44-0005
- v44-0006-nss-Documentation.patch (application/octet-stream) patch v44-0006
- v44-0007-nss-Support-NSS-in-pgcrypto.patch (application/octet-stream) patch v44-0007
- v44-0008-nss-Support-NSS-in-sslinfo.patch (application/octet-stream) patch v44-0008
- v44-0009-nss-Support-NSS-in-cryptohash.patch (application/octet-stream) patch v44-0009
- v44-0010-nss-Build-infrastructure.patch (application/octet-stream) patch v44-0010
> On 28 Sep 2021, at 01:07, Rachel Heaton <rachelmheaton@gmail.com> wrote: > 1. I get 7 warnings while running make (truncated): > cryptohash_nss.c:101:21: warning: implicit conversion from enumeration > type 'SECOidTag' to different enumeration type 'HASH_HashType' Nice catch, fixed in the attached. > 2. libpq-refs-stamp fails -- it appears an exit is being injected into > libpq on Mac I spent some time investigating this, and there are two cases of _exit() and one atexit() which are coming from the threading code in libnspr (which is the runtime lib required by libnss). On macOS the threading code registers an atexit handler [0] in order to work around issues with __attribute__((destructor)) [1]. The pthreads code also defines PR_ProcessExit [2] which does what it says on the tin, calls exit and not much more [3]. Both of these uses are only compiled when building with pthreads, which can be disabled in autoconf but that seems broken in recent version of NSPR. I'm fairly sure I've built NSPR with the user pthreads in the past, but if packagers build it like this then we need to conform to that. The PR_CreateProcess() [4] call further calls _exit() [5] in a number of error paths on failing syscalls. The libpq libnss implementation doesn't call either of these, and neither does libnss. I'm not entirely sure what to do here, it clearly requires an exception in the Makefile check of sorts if we deem we can live with this. @Jacob: how did you configure your copy of NSPR? -- Daniel Gustafsson https://vmware.com/ [0] https://hg.mozilla.org/projects/nspr/file/tip/pr/src/pthreads/ptthread.c#l1034 [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1399746#c99 [2] https://www-archive.mozilla.org/projects/nspr/reference/html/prinit.html#15859 [3] https://hg.mozilla.org/projects/nspr/file/tip/pr/src/pthreads/ptthread.c#l1181 [4] https://www-archive.mozilla.org/projects/nspr/reference/html/prprocess.html#24535 [5] https://hg.mozilla.org/projects/nspr/file/tip/pr/src/md/unix/uxproces.c#l268
Commits
-
Add tab-completion for CREATE FOREIGN TABLE.
- 74527c3e022d 15.0 cited
-
Add tap tests for the schema publications.
- 6b0f6f79eef2 15.0 cited
-
Move Perl test modules to a better namespace
- b3b4d8e68ae8 15.0 cited
-
Adjust configure to insist on Perl version >= 5.8.3.
- 92e6a98c3636 15.0 cited
-
Simplify code related to compilation of SSL and OpenSSL
- 092b785fad3d 14.0 landed
-
Introduce --with-ssl={openssl} as a configure option
- fe61df7f82aa 14.0 landed
-
Implement support for bulk inserts in postgres_fdw
- b663a4136331 14.0 cited
-
Fix redundant error messages in client tools
- 6be725e70161 14.0 cited
-
doc: Apply more consistently <productname> markup for OpenSSL
- 089da3c4778f 14.0 landed
-
Check ssl_in_use flag when reporting statistics
- 6a5c750f3f72 14.0 cited