aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/dbcommands.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2023-11-27 09:40:50 +0900
committerMichael Paquier <michael@paquier.xyz>2023-11-27 09:40:50 +0900
commitb97226815030be274f13a114cf8ebf0063899c41 (patch)
tree37158503b78faa0a6e5f43081c64620e2220d821 /src/backend/commands/dbcommands.c
parentc7bd476049ca43ed86faae02c7c1cc3553ebe93c (diff)
downloadpostgresql-b97226815030be274f13a114cf8ebf0063899c41.tar.gz
postgresql-b97226815030be274f13a114cf8ebf0063899c41.zip
Fix race condition with BIO methods initialization in libpq with threads
The libpq code in charge of creating per-connection SSL objects was prone to a race condition when loading the custom BIO methods needed by my_SSL_set_fd(). As BIO methods are stored as a static variable, the initialization of a connection could fail because it could be possible to have one thread refer to my_bio_methods while it is being manipulated by a second concurrent thread. This error has been introduced by 8bb14cdd33de, that has removed ssl_config_mutex around the call of my_SSL_set_fd(), that itself sets the custom BIO methods used in libpq. Like previously, the BIO method initialization is now protected by the existing ssl_config_mutex, itself initialized earlier for WIN32. While on it, document that my_bio_methods is protected by ssl_config_mutex, as this can be easy to miss. Reported-by: Willi Mann Author: Willi Mann, Michael Paquier Discussion: https://postgr.es/m/e77abc4c-4d03-4058-a9d7-ef0035657e04@celonis.com Backpatch-through: 12
Diffstat (limited to 'src/backend/commands/dbcommands.c')
0 files changed, 0 insertions, 0 deletions