Avoid possible crash within libsanitizer.
authorTom Lane <[email protected]>
Wed, 5 Nov 2025 16:09:30 +0000 (11:09 -0500)
committerTom Lane <[email protected]>
Wed, 5 Nov 2025 16:09:30 +0000 (11:09 -0500)
commita9515f294de153360e58d17a9aa468532cbab7e5
treeb6f653bf20e0dd7ffc8b72f6ecb8ff91738ab7d3
parent1dad5594c19ed46672b4fbad0527df63e502d444
Avoid possible crash within libsanitizer.

We've successfully used libsanitizer for awhile with the undefined
and alignment sanitizers, but with some other sanitizers (at least
thread and hwaddress) it crashes due to internal recursion before
it's fully initialized itself.  It turns out that that's due to the
"__ubsan_default_options" hack installed by commit f686ae82f, and we
can fix it by ensuring that __ubsan_default_options is built without
any sanitizer instrumentation hooks.

Reported-by: Emmanuel Sibi <[email protected]>
Reported-by: Alexander Lakhin <[email protected]>
Diagnosed-by: Emmanuel Sibi <[email protected]>
Fix-suggested-by: Jacob Champion <[email protected]>
Author: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/F7543B04-E56C-4D68-A040-B14CCBAD38F1@gmail.com
Discussion: https://postgr.es/m/dbf77bf7-6e54-ed8a-c4ae-d196eeb664ce@gmail.com
Backpatch-through: 16
src/backend/main/main.c