Re: BUG #19095: Test if function exit() is used fail when linked static

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, Michael Paquier <michael(at)paquier(dot)xyz>, BharatDB <bharatdbpg(at)gmail(dot)com>, torsten(dot)rupp(at)gmx(dot)net, pgsql-bugs(at)lists(dot)postgresql(dot)org, VASUKI M <vasukim1992002(at)gmail(dot)com>
Subject: Re: BUG #19095: Test if function exit() is used fail when linked static
Date: 2025-11-14 14:40:46
Message-ID: 3133108.1763131246@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> 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?

ATM it's not something we'd be tempted to call, but I take your point.

> 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.

My recollection is that that doesn't help as much as you'd think.
__tsan_func_exit, for one, can get injected into our own .o files
if we build with appropriate sanitizers enabled.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Greg Sabino Mullane 2025-11-14 16:21:32 Re: BUG #19112: Error comes up on login to the QueryTool after update to PgAdmin 9.10
Previous Message Andres Freund 2025-11-14 14:01:06 Re: BUG #19095: Test if function exit() is used fail when linked static

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-11-14 14:44:42 Re: Uncommented GUC in postgresql.conf.sample
Previous Message Viktor Holmberg 2025-11-14 14:34:08 Re: ON CONFLICT DO SELECT (take 3)