pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Distrust external OpenSSL clients; clear err queue 6+ messages / 1 participants [nested] [flat]
* pgsql: Distrust external OpenSSL clients; clear err queue @ 2016-04-08 18:12 Peter Eisentraut <peter_e@gmx.net> 0 siblings, 0 replies; 6+ messages in thread From: Peter Eisentraut @ 2016-04-08 18:12 UTC (permalink / raw) To: pgsql-committers Distrust external OpenSSL clients; clear err queue OpenSSL has an unfortunate tendency to mix per-session state error handling with per-thread error handling. This can cause problems when programs that link to libpq with OpenSSL enabled have some other use of OpenSSL; without care, one caller of OpenSSL may cause problems for the other caller. Backend code might similarly be affected, for example when a third party extension independently uses OpenSSL without taking the appropriate precautions. To fix, don't trust other users of OpenSSL to clear the per-thread error queue. Instead, clear the entire per-thread queue ahead of certain I/O operations when it appears that there might be trouble (these I/O operations mostly need to call SSL_get_error() to check for success, which relies on the queue being empty). This is slightly aggressive, but it's pretty clear that the other callers have a very dubious claim to ownership of the per-thread queue. Do this is both frontend and backend code. Finally, be more careful about clearing our own error queue, so as to not cause these problems ourself. It's possibly that control previously did not always reach SSLerrmessage(), where ERR_get_error() was supposed to be called to clear the queue's earliest code. Make sure ERR_get_error() is always called, so as to spare other users of OpenSSL the possibility of similar problems caused by libpq (as opposed to problems caused by a third party OpenSSL library like PHP's OpenSSL extension). Again, do this is both frontend and backend code. See bug #12799 and https://bugs.php.net/bug.php?id=68276 Based on patches by Dave Vitek and Peter Eisentraut. From: Peter Geoghegan <pg@bowt.ie> Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/7c7d4fddab82dc756d8caa67b1b31fcdde355aab Modified Files -------------- src/backend/libpq/be-secure-openssl.c | 70 ++++++++++++++++++++--------- src/interfaces/libpq/fe-secure-openssl.c | 77 ++++++++++++++++++++++---------- 2 files changed, 102 insertions(+), 45 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Distrust external OpenSSL clients; clear err queue @ 2016-05-07 04:11 Peter Eisentraut <peter_e@gmx.net> 0 siblings, 0 replies; 6+ messages in thread From: Peter Eisentraut @ 2016-05-07 04:11 UTC (permalink / raw) To: pgsql-committers Distrust external OpenSSL clients; clear err queue OpenSSL has an unfortunate tendency to mix per-session state error handling with per-thread error handling. This can cause problems when programs that link to libpq with OpenSSL enabled have some other use of OpenSSL; without care, one caller of OpenSSL may cause problems for the other caller. Backend code might similarly be affected, for example when a third party extension independently uses OpenSSL without taking the appropriate precautions. To fix, don't trust other users of OpenSSL to clear the per-thread error queue. Instead, clear the entire per-thread queue ahead of certain I/O operations when it appears that there might be trouble (these I/O operations mostly need to call SSL_get_error() to check for success, which relies on the queue being empty). This is slightly aggressive, but it's pretty clear that the other callers have a very dubious claim to ownership of the per-thread queue. Do this is both frontend and backend code. Finally, be more careful about clearing our own error queue, so as to not cause these problems ourself. It's possibly that control previously did not always reach SSLerrmessage(), where ERR_get_error() was supposed to be called to clear the queue's earliest code. Make sure ERR_get_error() is always called, so as to spare other users of OpenSSL the possibility of similar problems caused by libpq (as opposed to problems caused by a third party OpenSSL library like PHP's OpenSSL extension). Again, do this is both frontend and backend code. See bug #12799 and https://bugs.php.net/bug.php?id=68276 Based on patches by Dave Vitek and Peter Eisentraut. From: Peter Geoghegan <pg@bowt.ie> Branch ------ REL9_3_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/a9d8644de09e9b27ea9eb9148d2476b0d6c9eb90 Modified Files -------------- src/backend/libpq/be-secure.c | 68 ++++++++++++++++++++++++----------- src/interfaces/libpq/fe-secure.c | 78 +++++++++++++++++++++++++++------------- 2 files changed, 102 insertions(+), 44 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Distrust external OpenSSL clients; clear err queue @ 2016-05-07 04:11 Peter Eisentraut <peter_e@gmx.net> 0 siblings, 0 replies; 6+ messages in thread From: Peter Eisentraut @ 2016-05-07 04:11 UTC (permalink / raw) To: pgsql-committers Distrust external OpenSSL clients; clear err queue OpenSSL has an unfortunate tendency to mix per-session state error handling with per-thread error handling. This can cause problems when programs that link to libpq with OpenSSL enabled have some other use of OpenSSL; without care, one caller of OpenSSL may cause problems for the other caller. Backend code might similarly be affected, for example when a third party extension independently uses OpenSSL without taking the appropriate precautions. To fix, don't trust other users of OpenSSL to clear the per-thread error queue. Instead, clear the entire per-thread queue ahead of certain I/O operations when it appears that there might be trouble (these I/O operations mostly need to call SSL_get_error() to check for success, which relies on the queue being empty). This is slightly aggressive, but it's pretty clear that the other callers have a very dubious claim to ownership of the per-thread queue. Do this is both frontend and backend code. Finally, be more careful about clearing our own error queue, so as to not cause these problems ourself. It's possibly that control previously did not always reach SSLerrmessage(), where ERR_get_error() was supposed to be called to clear the queue's earliest code. Make sure ERR_get_error() is always called, so as to spare other users of OpenSSL the possibility of similar problems caused by libpq (as opposed to problems caused by a third party OpenSSL library like PHP's OpenSSL extension). Again, do this is both frontend and backend code. See bug #12799 and https://bugs.php.net/bug.php?id=68276 Based on patches by Dave Vitek and Peter Eisentraut. From: Peter Geoghegan <pg@bowt.ie> Branch ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/e3b14de9f0453d29c1d77b081d312b2eac6b192a Modified Files -------------- src/backend/libpq/be-secure.c | 68 ++++++++++++++++++++++++----------- src/interfaces/libpq/fe-secure.c | 78 +++++++++++++++++++++++++++------------- 2 files changed, 102 insertions(+), 44 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Distrust external OpenSSL clients; clear err queue @ 2016-05-07 04:11 Peter Eisentraut <peter_e@gmx.net> 0 siblings, 0 replies; 6+ messages in thread From: Peter Eisentraut @ 2016-05-07 04:11 UTC (permalink / raw) To: pgsql-committers Distrust external OpenSSL clients; clear err queue OpenSSL has an unfortunate tendency to mix per-session state error handling with per-thread error handling. This can cause problems when programs that link to libpq with OpenSSL enabled have some other use of OpenSSL; without care, one caller of OpenSSL may cause problems for the other caller. Backend code might similarly be affected, for example when a third party extension independently uses OpenSSL without taking the appropriate precautions. To fix, don't trust other users of OpenSSL to clear the per-thread error queue. Instead, clear the entire per-thread queue ahead of certain I/O operations when it appears that there might be trouble (these I/O operations mostly need to call SSL_get_error() to check for success, which relies on the queue being empty). This is slightly aggressive, but it's pretty clear that the other callers have a very dubious claim to ownership of the per-thread queue. Do this is both frontend and backend code. Finally, be more careful about clearing our own error queue, so as to not cause these problems ourself. It's possibly that control previously did not always reach SSLerrmessage(), where ERR_get_error() was supposed to be called to clear the queue's earliest code. Make sure ERR_get_error() is always called, so as to spare other users of OpenSSL the possibility of similar problems caused by libpq (as opposed to problems caused by a third party OpenSSL library like PHP's OpenSSL extension). Again, do this is both frontend and backend code. See bug #12799 and https://bugs.php.net/bug.php?id=68276 Based on patches by Dave Vitek and Peter Eisentraut. From: Peter Geoghegan <pg@bowt.ie> Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/a3c17b2af89cd46b47df3483bb693312d7521795 Modified Files -------------- src/backend/libpq/be-secure-openssl.c | 70 ++++++++++++++++++++--------- src/interfaces/libpq/fe-secure-openssl.c | 77 ++++++++++++++++++++++---------- 2 files changed, 102 insertions(+), 45 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Distrust external OpenSSL clients; clear err queue @ 2016-05-07 04:11 Peter Eisentraut <peter_e@gmx.net> 0 siblings, 0 replies; 6+ messages in thread From: Peter Eisentraut @ 2016-05-07 04:11 UTC (permalink / raw) To: pgsql-committers Distrust external OpenSSL clients; clear err queue OpenSSL has an unfortunate tendency to mix per-session state error handling with per-thread error handling. This can cause problems when programs that link to libpq with OpenSSL enabled have some other use of OpenSSL; without care, one caller of OpenSSL may cause problems for the other caller. Backend code might similarly be affected, for example when a third party extension independently uses OpenSSL without taking the appropriate precautions. To fix, don't trust other users of OpenSSL to clear the per-thread error queue. Instead, clear the entire per-thread queue ahead of certain I/O operations when it appears that there might be trouble (these I/O operations mostly need to call SSL_get_error() to check for success, which relies on the queue being empty). This is slightly aggressive, but it's pretty clear that the other callers have a very dubious claim to ownership of the per-thread queue. Do this is both frontend and backend code. Finally, be more careful about clearing our own error queue, so as to not cause these problems ourself. It's possibly that control previously did not always reach SSLerrmessage(), where ERR_get_error() was supposed to be called to clear the queue's earliest code. Make sure ERR_get_error() is always called, so as to spare other users of OpenSSL the possibility of similar problems caused by libpq (as opposed to problems caused by a third party OpenSSL library like PHP's OpenSSL extension). Again, do this is both frontend and backend code. See bug #12799 and https://bugs.php.net/bug.php?id=68276 Based on patches by Dave Vitek and Peter Eisentraut. From: Peter Geoghegan <pg@bowt.ie> Branch ------ REL9_2_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/e3a493ac08b7b0fb9de85a002aeff69e4f8fba43 Modified Files -------------- src/backend/libpq/be-secure.c | 68 ++++++++++++++++++++++++----------- src/interfaces/libpq/fe-secure.c | 78 +++++++++++++++++++++++++++------------- 2 files changed, 102 insertions(+), 44 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Distrust external OpenSSL clients; clear err queue @ 2016-05-07 04:11 Peter Eisentraut <peter_e@gmx.net> 0 siblings, 0 replies; 6+ messages in thread From: Peter Eisentraut @ 2016-05-07 04:11 UTC (permalink / raw) To: pgsql-committers Distrust external OpenSSL clients; clear err queue OpenSSL has an unfortunate tendency to mix per-session state error handling with per-thread error handling. This can cause problems when programs that link to libpq with OpenSSL enabled have some other use of OpenSSL; without care, one caller of OpenSSL may cause problems for the other caller. Backend code might similarly be affected, for example when a third party extension independently uses OpenSSL without taking the appropriate precautions. To fix, don't trust other users of OpenSSL to clear the per-thread error queue. Instead, clear the entire per-thread queue ahead of certain I/O operations when it appears that there might be trouble (these I/O operations mostly need to call SSL_get_error() to check for success, which relies on the queue being empty). This is slightly aggressive, but it's pretty clear that the other callers have a very dubious claim to ownership of the per-thread queue. Do this is both frontend and backend code. Finally, be more careful about clearing our own error queue, so as to not cause these problems ourself. It's possibly that control previously did not always reach SSLerrmessage(), where ERR_get_error() was supposed to be called to clear the queue's earliest code. Make sure ERR_get_error() is always called, so as to spare other users of OpenSSL the possibility of similar problems caused by libpq (as opposed to problems caused by a third party OpenSSL library like PHP's OpenSSL extension). Again, do this is both frontend and backend code. See bug #12799 and https://bugs.php.net/bug.php?id=68276 Based on patches by Dave Vitek and Peter Eisentraut. From: Peter Geoghegan <pg@bowt.ie> Branch ------ REL9_1_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/9b676fd49a34e1e4001f19331e9cb4a8d688bb06 Modified Files -------------- src/backend/libpq/be-secure.c | 69 ++++++++++++++++++++++++----------- src/interfaces/libpq/fe-secure.c | 78 +++++++++++++++++++++++++++------------- 2 files changed, 103 insertions(+), 44 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2016-05-07 04:11 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2016-04-08 18:12 pgsql: Distrust external OpenSSL clients; clear err queue Peter Eisentraut <peter_e@gmx.net> 2016-05-07 04:11 pgsql: Distrust external OpenSSL clients; clear err queue Peter Eisentraut <peter_e@gmx.net> 2016-05-07 04:11 pgsql: Distrust external OpenSSL clients; clear err queue Peter Eisentraut <peter_e@gmx.net> 2016-05-07 04:11 pgsql: Distrust external OpenSSL clients; clear err queue Peter Eisentraut <peter_e@gmx.net> 2016-05-07 04:11 pgsql: Distrust external OpenSSL clients; clear err queue Peter Eisentraut <peter_e@gmx.net> 2016-05-07 04:11 pgsql: Distrust external OpenSSL clients; clear err queue Peter Eisentraut <peter_e@gmx.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox