Re: [BUG] PostgreSQL crashes with ThreadSanitizer during early initialization
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jacob Champion <jacob.champion@enterprisedb.com>
Cc: Emmanuel Sibi <emmanuelsibi.mec@gmail.com>,
pgsql-hackers@lists.postgresql.org, Andres Freund <andres@anarazel.de>
Date: 2025-11-05T01:19:35Z
Lists: pgsql-hackers
Jacob Champion <jacob.champion@enterprisedb.com> writes:
> On Tue, Nov 4, 2025 at 2:39 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Another problem is that it only defends against a limited set of
>> sanitizers, though presumably every single one is broken in the same
>> way (compare [1]).
> How about __attribute__((disable_sanitizer_instrumentation)) ? LLVM's
> own tests make some use of this [1].
Hah, thanks for the research! For me, this stops the failure
(on RHEL9 with clang version 19.1.7):
diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index bdcb5e4f261..1bd63ec9184 100644
--- a/src/backend/main/main.c
+++ b/src/backend/main/main.c
@@ -500,6 +500,10 @@ check_root(const char *progname)
* seem necessary to only compile it conditionally.
*/
const char *__ubsan_default_options(void);
+
+#if __has_attribute(disable_sanitizer_instrumentation)
+__attribute__((disable_sanitizer_instrumentation))
+#endif
const char *
__ubsan_default_options(void)
{
Assuming that works for Emmanuel, we could wrap it in a
pg_disable_sanitizer_instrumentation macro, or just use it
as-is. I don't have a strong preference --- any thoughts?
(It could do with a comment, either way.)
regards, tom lane
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Avoid possible crash within libsanitizer.
- d4baa327a1c9 19 (unreleased) landed
- c775bf048abd 16.11 landed
- a9515f294de1 17.7 landed
- 6d8acb777715 18.1 landed