Hi,

On 2026-10-26 11:15:46 +0900, Henson Choi wrote:
> On an AddressSanitizer build, every JIT-compiled query crashes or
> hangs the backend while the JIT generates code for it, even "SELECT 1"
> with jit = on and jit_above_cost = 0.  On Linux the backend dies of
> SIGILL; on macOS it loops forever inside LLVM.

I found the same thing a few days ago while reviewing another patch.

I was pretty confused as to why this was not an issue we noticed longer ago.


There's a bunch of annoying circumstances at hand here:

1) we used to not pass c_args to bitcode compilation, that was changed in 17,
   with
   Author: Peter Eisentraut <[email protected]>
   Branch: master Release: REL_17_BR [1039352e1] 2024-06-06 22:36:43 +0200

       meson: Add user-provided c_args to bitcode_cflags

       This is needed for example to pass an include path set in the CPPFLAGS
       environment variable to the bitcode compile command.

       Discussion: 
https://www.postgresql.org/message-id/flat/c1384a7b-ed12-4862-a0da-a05c7945171a%40eisentraut.org

2) In autoconf I think we still don't (we IIRC pre-filter flags)

3) In cirrus-ci CI we used autoconf to build the asan build, so it would not
   fail with asan

4) JIT was disabled by default on 19 / master just before we added github
   actions based CI

   That commit did not force-enable JIT in any test, which ain't optimal.


Because of a negative interaction with an upcoming fix, I plan to apply
Henson's 0004 to 17 to master.

In 16, the one older branch with meson support, it is not needed (see point 1
above), and in <= 16 pg_attribute_no_sanitize_address() didn't exist yet.


After the next set of minors we can polish this into a better state, with a
proper test and perhaps backpatching it all the way. Or going with a different
approach (like filtering c_args or replacing 1039352e1 with something else).


Unless somebody disagrees rather quickly with my plan?


Greetings,

Andres


Reply via email to