Re: Postmaster self-deadlock due to PLT linkage resolution

2023-08-06 Thread Thomas Munro
After commit 7389aad6, I think commit 8acd8f86's linker changes (+ meson.build's equivalent) must now be redundant?

Re: Postmaster self-deadlock due to PLT linkage resolution

2022-09-04 Thread Thomas Munro
On Wed, Aug 31, 2022 at 1:34 AM Thomas Munro wrote: > On Wed, Aug 31, 2022 at 12:26 AM Robert Haas wrote: > > On Tue, Aug 30, 2022 at 8:17 AM Thomas Munro wrote: > > > FWIW I suspect FreeBSD can't break like this in a program linked with > > > libthr, because it has a scheme for deferring signal

Re: Postmaster self-deadlock due to PLT linkage resolution

2022-08-30 Thread Andres Freund
Hi, On 2022-08-30 14:32:26 -0400, Tom Lane wrote: > Andres Freund writes: > > On 2022-08-30 14:07:41 -0400, Tom Lane wrote: > >> Do we want to install this just for NetBSD, or more widely? > >> I think we'd better back-patch it for NetBSD, so I'm inclined > >> to be conservative about the change.

Re: Postmaster self-deadlock due to PLT linkage resolution

2022-08-30 Thread Tom Lane
Andres Freund writes: > On 2022-08-30 14:07:41 -0400, Tom Lane wrote: >> Do we want to install this just for NetBSD, or more widely? >> I think we'd better back-patch it for NetBSD, so I'm inclined >> to be conservative about the change. > It's likely a good idea to enable it everywhere applicabl

Re: Postmaster self-deadlock due to PLT linkage resolution

2022-08-30 Thread Andres Freund
Hi, On 2022-08-30 14:07:41 -0400, Tom Lane wrote: > Andres Freund writes: > > On 2022-08-30 13:24:39 -0400, Tom Lane wrote: > >> Andres Freund writes: > >>> Perhaps it'd be saner to default to building with -Wl,-z,now? That should > >>> fix > >>> the problem too, right (and if we combine it wit

Re: Postmaster self-deadlock due to PLT linkage resolution

2022-08-30 Thread Tom Lane
Andres Freund writes: > On 2022-08-30 13:24:39 -0400, Tom Lane wrote: >> Andres Freund writes: >>> Perhaps it'd be saner to default to building with -Wl,-z,now? That should >>> fix >>> the problem too, right (and if we combine it with relro, it'd be a security >>> improvement to boot). >> Hm.

Re: Postmaster self-deadlock due to PLT linkage resolution

2022-08-30 Thread Andres Freund
Hi, On 2022-08-30 13:24:39 -0400, Tom Lane wrote: > Andres Freund writes: > > Perhaps it'd be saner to default to building with -Wl,-z,now? That should > > fix > > the problem too, right (and if we combine it with relro, it'd be a security > > improvement to boot). > > Hm. Not sure if that wor

Re: Postmaster self-deadlock due to PLT linkage resolution

2022-08-30 Thread Tom Lane
Andres Freund writes: > On 2022-08-29 15:43:55 -0400, Tom Lane wrote: >> The attached patch seems to fix the problem, by forcing resolution of >> the PLT link before we unblock signals. It depends on the assumption >> that another select() call appearing within postmaster.c will share >> the same

Re: Postmaster self-deadlock due to PLT linkage resolution

2022-08-30 Thread Andres Freund
Hi, On 2022-08-29 15:43:55 -0400, Tom Lane wrote: > Buildfarm member mamba (NetBSD-current on prairiedog's former hardware) > has failed repeatedly since I set it up. I have now run the cause of > that to ground [1], and here's what's happening: if the postmaster > receives a signal just before i

Re: Postmaster self-deadlock due to PLT linkage resolution

2022-08-30 Thread Thomas Munro
On Wed, Aug 31, 2022 at 12:26 AM Robert Haas wrote: > On Tue, Aug 30, 2022 at 8:17 AM Thomas Munro wrote: > > FWIW I suspect FreeBSD can't break like this in a program linked with > > libthr, because it has a scheme for deferring signals while the > > runtime linker holds locks. _rtld_bind calls

Re: Postmaster self-deadlock due to PLT linkage resolution

2022-08-30 Thread Robert Haas
On Tue, Aug 30, 2022 at 8:17 AM Thomas Munro wrote: > FWIW I suspect FreeBSD can't break like this in a program linked with > libthr, because it has a scheme for deferring signals while the > runtime linker holds locks. _rtld_bind calls _thr_rtld_rlock_acquire, > which uses the THR_CRITICAL_ENTER

Re: Postmaster self-deadlock due to PLT linkage resolution

2022-08-30 Thread Thomas Munro
On Tue, Aug 30, 2022 at 7:44 AM Tom Lane wrote: > Buildfarm member mamba (NetBSD-current on prairiedog's former hardware) > has failed repeatedly since I set it up. I have now run the cause of > that to ground [1], and here's what's happening: if the postmaster > receives a signal just before it

Re: Postmaster self-deadlock due to PLT linkage resolution

2022-08-29 Thread Noah Misch
On Mon, Aug 29, 2022 at 03:43:55PM -0400, Tom Lane wrote: > I'd originally intended to make this code "#ifdef __NetBSD__", > but on looking into the FreeBSD sources I find much the same locking > logic in their dynamic loader, and now I'm wondering if such behavior > isn't pretty standard. I doubt