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 <[email protected]> Discussion: https://postgr.es/m/caaae_za49chxj7j4hmeusa75s+esgconk_9uvq6wuej2bgv...@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(+)
