Re: [BUG] PostgreSQL crashes with ThreadSanitizer during early initialization - Mailing list pgsql-hackers

From Emmanuel Sibi
Subject Re: [BUG] PostgreSQL crashes with ThreadSanitizer during early initialization
Date
Msg-id CAJhJm+hXx+Qnk33TbTMsXqLhkpsT3EgAWrofac=baN7s3LPzdQ@mail.gmail.com
Whole thread Raw
In response to Re: [BUG] PostgreSQL crashes with ThreadSanitizer during early initialization  (Aleksander Alekseev <aleksander@tigerdata.com>)
Responses Re: [BUG] PostgreSQL crashes with ThreadSanitizer during early initialization
List pgsql-hackers
Hi Aleksander,
> Thanks for reporting this. Did you investigate whether Meson also has
> this issue? Fixing anything for Autotools arguably has low priority
> since we are going to get rid of it in the near future, but Meson is
> another matter.

Thanks for the reply. Yes, I tested with Meson and confirmed the same
issue occurs.
When building PostgreSQL 17.2 with ThreadSanitizer:
meson setup builddir \
   --prefix=/path/to/install \
   --buildtype=debug \
   -Dcassert=true \
   -Dtap_tests=enabled \
   -Db_lto=false \
   -Db_sanitize=thread \
   -Db_lundef=false \
   -Dc_args="-O0 -g -gdwarf-2 -fno-omit-frame-pointer"

The postgres binary segfaults during early initialization, exactly as
with the Autotools build.
Applying the patch I submitted, which moves __ubsan_default_options()
to a separate compilation unit built without sanitizer
instrumentation, successfully resolves the segfault.

Thanks & regards,
Emmanuel Sibi



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access)
Next
From: Nathan Bossart
Date:
Subject: Re: GetNamedLWLockTranche crashes on Windows in normal backend