From fe8f92cfe4c6dee6d2cf4776f0aee43a9eafbc35 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mar 31 2020 09:41:39 +0000 Subject: import postgresql-9.2.24-2.el7 --- diff --git a/SOURCES/postgresql-9.2.24-handle-EAGAIN-on-socket-write.patch b/SOURCES/postgresql-9.2.24-handle-EAGAIN-on-socket-write.patch deleted file mode 100644 index f733aea..0000000 --- a/SOURCES/postgresql-9.2.24-handle-EAGAIN-on-socket-write.patch +++ /dev/null @@ -1,26 +0,0 @@ -From ab371f752536e88307b2c6867d6821ec1397525e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Patrik=20Novotn=C3=BD?= -Date: Fri, 24 Jan 2020 01:04:48 +0100 -Subject: [PATCH] Handle EAGAIN error on socket write - - See BZ#1754816 ---- - src/backend/libpq/be-secure.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/backend/libpq/be-secure.c b/src/backend/libpq/be-secure.c -index f6d9bc50c7..5af1f15239 100644 ---- a/src/backend/libpq/be-secure.c -+++ b/src/backend/libpq/be-secure.c -@@ -522,7 +522,7 @@ my_sock_write(BIO *h, const char *buf, int size) - BIO_clear_retry_flags(h); - if (res <= 0) - { -- if (errno == EINTR) -+ if (errno == EINTR || errno == EAGAIN) - { - BIO_set_retry_write(h); - } --- -2.24.1 - diff --git a/SOURCES/postgresql-libpq-crypto-no-callback-stomping-v2.patch b/SOURCES/postgresql-libpq-crypto-no-callback-stomping-v2.patch new file mode 100644 index 0000000..f2933bb --- /dev/null +++ b/SOURCES/postgresql-libpq-crypto-no-callback-stomping-v2.patch @@ -0,0 +1,52 @@ +Do not attempt to manage OpenSSL locking callbacks in libpq + +A deadlock occurs when connecting to Postgresql using SSL with postgresql-libs in +a multi-threaded environment with other threads performing SSL independently. + +This issue has been causing Module Build Service (https://pagure.io/fm-orchestrator) +outages, which is deployed on RHEL 7.4 but with the latest postgresql-libs package installed. + +You can find a reproducer script and a more in-depth description of the issue here: +https://postgrespro.com/list/thread-id/1861629 + +The upstream patch that resolves this issue is here: +https://commitfest.postgresql.org/4/140/ + +RHBZ: #1755154 + +diff -ur postgresql-9.2.24/src/interfaces/libpq/fe-secure.c postgresql-patch/src/interfaces/libpq/fe-secure.c +--- postgresql-9.2.24/src/interfaces/libpq/fe-secure.c 2017-11-06 23:17:39.000000000 +0100 ++++ postgresql-patch/src/interfaces/libpq/fe-secure.c 2019-10-29 15:25:28.448918186 +0100 +@@ -941,9 +941,12 @@ + + if (ssl_open_connections++ == 0) + { +- /* These are only required for threaded libcrypto applications */ +- CRYPTO_set_id_callback(pq_threadidcallback); +- CRYPTO_set_locking_callback(pq_lockingcallback); ++ /* These are only required for threaded libcrypto applications, but ++ * make sure we don't stomp on them if they're already set. */ ++ if (CRYPTO_get_id_callback() == NULL) ++ CRYPTO_set_id_callback(pq_threadidcallback); ++ if (CRYPTO_get_locking_callback() == NULL) ++ CRYPTO_set_locking_callback(pq_lockingcallback); + } + } + #endif /* HAVE_CRYPTO_LOCK */ +@@ -997,10 +1000,13 @@ + + if (pq_init_crypto_lib && ssl_open_connections == 0) + { +- /* No connections left, unregister libcrypto callbacks */ +- CRYPTO_set_locking_callback(NULL); +- CRYPTO_set_id_callback(NULL); + ++ /* No connections left, unregister libcrypto callbacks, if no one ++ * registered different ones in the meantime. */ ++ if (CRYPTO_get_id_callback() == pq_threadidcallback) ++ CRYPTO_set_id_callback(NULL); ++ if (CRYPTO_get_locking_callback() == pq_lockingcallback) ++ CRYPTO_set_locking_callback(NULL); + /* + * We don't free the lock array. If we get another connection in + * this process, we will just re-use them with the existing mutexes. diff --git a/SPECS/postgresql.spec b/SPECS/postgresql.spec index a4de493..121b4a8 100644 --- a/SPECS/postgresql.spec +++ b/SPECS/postgresql.spec @@ -135,8 +135,8 @@ Patch13: postgresql-9.2.4-upgrade-and-perm-problems.patch # Upstream commit: 243de06be96d6001d01f2ec7c4573aad8b657195 Patch14: postgresql-CVE-2018-10915.patch -# See BZ#1754816 -Patch15: postgresql-9.2.24-handle-EAGAIN-on-socket-write.patch +# Check if callback is already set +Patch15: postgresql-libpq-crypto-no-callback-stomping-v2.patch BuildRequires: perl(ExtUtils::MakeMaker) glibc-devel bison flex gawk help2man BuildRequires: perl(ExtUtils::Embed), perl-devel @@ -1174,8 +1174,9 @@ fi %endif %changelog -* Fri Jan 24 2020 Patrik Novotný - 9.2.24-2 -- Patch fixing BZ#1754816: handle EAGAIN error on socket write +* Tue Nov 5 2019 Filip Januš 9.2.24-2 +- Check if callback is already set + Resolves: #1755154 * Tue Aug 14 2018 Pavel Raiskup - 9.2.24-1 - update to the latest 9.2 release