Re: [PATCH] fix race condition in libpq (related to ssl connections)

2023-11-26 Thread Michael Paquier
On Fri, Nov 24, 2023 at 04:48:58PM +0900, Michael Paquier wrote: > I've looked at this idea, and finished by being unhappy with the error > handling that we are currently assuming in my_SSL_set_fd() in the > event of an error in the bio method setup, which would be most likely > an OOM, so let's us

Re: [PATCH] fix race condition in libpq (related to ssl connections)

2023-11-23 Thread Michael Paquier
On Wed, Nov 22, 2023 at 10:43:32AM +0900, Michael Paquier wrote: > I am not really convinced that we require a second mutex here, as > there is always a concern with inter-locking changes. I may be > missing something, of course, but BIO_s_socket() is just a pointer to > a set of callbacks hidden

Re: [PATCH] fix race condition in libpq (related to ssl connections)

2023-11-23 Thread Michael Paquier
On Wed, Nov 22, 2023 at 02:58:15PM +1300, Thomas Munro wrote: > On Wed, Nov 22, 2023 at 2:44 PM Michael Paquier wrote: >> Because --disable-thread-safe has been removed recently in >> 68a4b58eca03. The routine could be marked as deprecated on top of >> saying that it always returns 1 for 17~. >

Re: [PATCH] fix race condition in libpq (related to ssl connections)

2023-11-21 Thread Thomas Munro
On Wed, Nov 22, 2023 at 2:44 PM Michael Paquier wrote: > On Tue, Nov 21, 2023 at 12:14:16PM +0300, Aleksander Alekseev wrote: > > I wonder if we should just document that libpq is thread safe as of PG > > v??? and deprecate PQisthreadsafe() at some point. Currently the > > documentation gives an i

Re: [PATCH] fix race condition in libpq (related to ssl connections)

2023-11-21 Thread Michael Paquier
On Tue, Nov 21, 2023 at 12:14:16PM +0300, Aleksander Alekseev wrote: > Please add the patch to the nearest open commit fest [2]. The patch > will be automatically picked up by cfbot [3] and tested on different > platforms. Also this way it will not be lost among other patches. I have noticed that

Re: [PATCH] fix race condition in libpq (related to ssl connections)

2023-11-21 Thread Michael Paquier
On Tue, Nov 21, 2023 at 12:14:16PM +0300, Aleksander Alekseev wrote: Thanks for the report, Willi, and the test case! Thanks Aleksander for the reply. > I wonder if we should just document that libpq is thread safe as of PG > v??? and deprecate PQisthreadsafe() at some point. Currently the > doc

Re: [PATCH] fix race condition in libpq (related to ssl connections)

2023-11-21 Thread Aleksander Alekseev
Hi, > I've found a race condition in libpq. It is about the initialization of > the my_bio_methods static variable in fe-secure-openssl.c, which is not > protected by any lock. The race condition may make the initialization of > the connection fail, and as an additional weird consequence, it might

[PATCH] fix race condition in libpq (related to ssl connections)

2023-11-20 Thread Willi Mann
Hi, I've found a race condition in libpq. It is about the initialization of the my_bio_methods static variable in fe-secure-openssl.c, which is not protected by any lock. The race condition may make the initialization of the connection fail, and as an additional weird consequence, it might cause