Обсуждение: libpq fails to build with TSAN

Поиск
Список
Период
Сортировка

libpq fails to build with TSAN

От
Roman Lozko
Дата:
Hi, so libpq has this line in its Makefile
https://github.com/postgres/postgres/blob/6ee26c6a4bafabbd22a85f575d2446fd5ec6ad0d/src/interfaces/libpq/Makefile#L116
which checks that libpq does not use any "exit" functions. With
ThreadSanitizer it triggers on function `__tsan_func_exit` which is
used to record returns from functions. Should it be added to exclusion
list here?

Error looks like this, just in case:
...
rm -f libpq.so
ln -s libpq.so.5.15 libpq.so
libpq.so.5.15:                 U __tsan_func_exit
libpq must not be calling any function which invokes exit
make: *** [Makefile:121: libpq-refs-stamp] Error 1



Re: libpq fails to build with TSAN

От
Daniel Gustafsson
Дата:
> On 31 Jan 2024, at 04:21, Roman Lozko <lozko.roma@gmail.com> wrote:
>
> Hi, so libpq has this line in its Makefile
> https://github.com/postgres/postgres/blob/6ee26c6a4bafabbd22a85f575d2446fd5ec6ad0d/src/interfaces/libpq/Makefile#L116
> which checks that libpq does not use any "exit" functions. With
> ThreadSanitizer it triggers on function `__tsan_func_exit` which is
> used to record returns from functions. Should it be added to exclusion
> list here?

I think it should, the idea of that check is to catch calls to actual exits,
while this is instrumentation which has nothing to do with exit(2).  The
attached diff should be enough to handle this.

--
Daniel Gustafsson


Вложения

Re: libpq fails to build with TSAN

От
Tom Lane
Дата:
Daniel Gustafsson <daniel@yesql.se> writes:
> I think it should, the idea of that check is to catch calls to actual exits,
> while this is instrumentation which has nothing to do with exit(2).  The
> attached diff should be enough to handle this.

+1

            regards, tom lane



Re: libpq fails to build with TSAN

От
Daniel Gustafsson
Дата:
> On 31 Jan 2024, at 16:39, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Daniel Gustafsson <daniel@yesql.se> writes:
>> I think it should, the idea of that check is to catch calls to actual exits,
>> while this is instrumentation which has nothing to do with exit(2).  The
>> attached diff should be enough to handle this.
>
> +1

Pushed.  It can be argued that it should be backpatched, but for now I've only
pushed it to master.  If there are strong opinions on backpatching I'd be happy
to fix that.

--
Daniel Gustafsson