pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Exclude the variables in llvmjit_types.c from AddressSanitizer
4+ messages / 1 participants
[nested] [flat]

* pgsql: Exclude the variables in llvmjit_types.c from AddressSanitizer
@ 2026-11-07 02:07 Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 4+ messages in thread

From: Andres Freund @ 2026-11-07 02:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(+)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Exclude the variables in llvmjit_types.c from AddressSanitizer
@ 2026-11-07 02:07 Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 4+ messages in thread

From: Andres Freund @ 2026-11-07 02:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/82297888f7ec1ef61100f37c1ea8632d396a95a1

Modified Files
--------------
src/backend/jit/llvm/llvmjit_types.c | 10 ++++++++++
1 file changed, 10 insertions(+)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Exclude the variables in llvmjit_types.c from AddressSanitizer
@ 2026-11-07 02:07 Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 4+ messages in thread

From: Andres Freund @ 2026-11-07 02:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1da6ddbdc32c5bf640429828bc0353ffcb40628e

Modified Files
--------------
src/backend/jit/llvm/llvmjit_types.c | 10 ++++++++++
1 file changed, 10 insertions(+)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Exclude the variables in llvmjit_types.c from AddressSanitizer
@ 2026-11-07 02:07 Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 4+ messages in thread

From: Andres Freund @ 2026-11-07 02:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e6b2f7c2b41d6261dac15825dede55e94ca35614

Modified Files
--------------
src/backend/jit/llvm/llvmjit_types.c | 10 ++++++++++
1 file changed, 10 insertions(+)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2026-11-07 02:07 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-07 02:07 pgsql: Exclude the variables in llvmjit_types.c from AddressSanitizer Andres Freund <andres@anarazel.de>
2026-11-07 02:07 pgsql: Exclude the variables in llvmjit_types.c from AddressSanitizer Andres Freund <andres@anarazel.de>
2026-11-07 02:07 pgsql: Exclude the variables in llvmjit_types.c from AddressSanitizer Andres Freund <andres@anarazel.de>
2026-11-07 02:07 pgsql: Exclude the variables in llvmjit_types.c from AddressSanitizer Andres Freund <andres@anarazel.de>

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