Re: BUG #19095: Test if function exit() is used fail when linked static - Mailing list pgsql-bugs

From Andres Freund
Subject Re: BUG #19095: Test if function exit() is used fail when linked static
Date
Msg-id 2wdijz5mucqx33vqzyep44uyucauw33egvwa7cbociesqlks5x@yj63saikpzwu
Whole thread Raw
In response to Re: BUG #19095: Test if function exit() is used fail when linked static  (Daniel Gustafsson <daniel@yesql.se>)
Responses Re: BUG #19095: Test if function exit() is used fail when linked static
Re: BUG #19095: Test if function exit() is used fail when linked static
List pgsql-bugs
Hi,
On 2025-11-14 13:11:15 +0100, Daniel Gustafsson wrote:
> > On 12 Nov 2025, at 09:15, Michael Paquier <michael@paquier.xyz> wrote:
> > 
> > On Wed, Nov 12, 2025 at 09:13:09AM +0100, Daniel Gustafsson wrote:
> >> On 12 Nov 2025, at 07:38, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >>> Personally I'm okay with whitelisting pthread_exit() as
> >>> Torsten suggested.
> >> 
> >> +1, we already have a few whitelisted entries and pthread_exit seems perfectly
> >> reasonable to add to that list.
> > 
> > WFM.
> 
> The attached trivial diff adds this to the whitelist clause in the Makefile.  I
> experimented with adding this to Meson, and while it's trivial enough to do the
> run_command with libpq_so.full_path, it's less clear to me exactly where in the
> build it should be added.  I've pinged my colleague Bilal who is much better at
> Meson than me to collaborate on that as a separate fix.

For meson we'll have to filter where we test this more strictly - it'll
e.g. not work on windows, because there's no nm, perhaps no grep, etc.

But more generally: If we allow pthread_exit(), what's the point of this test?
That's one of the functions we better avoid calling, no?


ISTM that if we do want to continue having this test, the issue is that we're
testing the shared library - which will have already linked against static
libraries like the sanitizer ones or in this case libcrypto. What we ought to
do is to test the .o files constituting libpq.so, rather than the already
linked .so. That way we will find our own calls to exit etc, but not ones in
static libraries.

Greetings,

Andres Freund



pgsql-bugs by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: BUG #19095: Test if function exit() is used fail when linked static
Next
From: Tom Lane
Date:
Subject: Re: BUG #19095: Test if function exit() is used fail when linked static