From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Exclude the variables in llvmjit_types.c from AddressSanitizer
Date: Sat, 07 Nov 2026 02:07:12 +0000
Message-ID: <E1xPVpo-00000000Xp4-2SSo@gemulon.postgresql.org> (raw)
Exclude the variables in llvmjit_types.c from AddressSanitizer
If address sanitizer is enabled, types of global variables are changed
to a container type, to include space for a red zone after each global
variable. Unfortunately, that causes mismatches with the generated code,
which in turn causes crashes when JIT is combined with ASAN.
This does not normally present a problem with autoconf builds, as we do
not pass CFLAGS on to bitcode generation, so in autoconf builds the
bitcode generation never sees sanitizer flags. Somewhat similarly, in
meson builds, c_args were not passed on to bitcode generation, but that
was changed with 1039352e1 in 17.
For now, just use #pragma to exclude global variables in llvmjit_types.c
from address sanitizer.
That might not be the best fix medium term, but we need a short-term
fix, due to an upcoming fix's tests hitting this issue.
We did not notice this historically as with cirrus-ci address sanitizer
was tested with autoconf, which does not have this specific issue. The
GHA based CI was only added after JIT was disabled by default.
For now this is just backpatched to 17, as earlier branches
a) don't have pg_attribute_no_sanitize_address()
b) don't currently need it, due to 1039352e1 only being in >= 17
Author: Henson Choi <assam258@gmail.com>
Discussion: https://postgr.es/m/CAAAe_zA49cHXJ7J4hmeuSa75s+eSgCOnK_9Uvq6wUEJ2Bgvdfg@mail.gmail.com
Backpatch-through: 17
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/0607aa61090ac1b574f8bafe854c684195b31e16
Modified Files
--------------
src/backend/jit/llvm/llvmjit_types.c | 10 ++++++++++
1 file changed, 10 insertions(+)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: andres@anarazel.de
Subject: Re: pgsql: Exclude the variables in llvmjit_types.c from AddressSanitizer
In-Reply-To: <E1xPVpo-00000000Xp4-2SSo@gemulon.postgresql.org>
References: <E1xPVpo-00000000Xp4-2SSo@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox