Re: [BUG] PostgreSQL crashes with ThreadSanitizer during early initialization

From: Emmanuel Sibi <emmanuelsibi(dot)mec(at)gmail(dot)com>
To: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [BUG] PostgreSQL crashes with ThreadSanitizer during early initialization
Date: 2025-09-08 16:43:54
Message-ID: CAJhJm+hXx+Qnk33TbTMsXqLhkpsT3EgAWrofac=baN7s3LPzdQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2025-09-08 16:55:14 Re: GetNamedLWLockTranche crashes on Windows in normal backend
Previous Message Robert Haas 2025-09-08 16:41:00 Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access)