From: "kjtsanaktsidis (KJ Tsanaktsidis) via ruby-core" <ruby-core@...> Date: 2024-02-11T22:25:15+00:00 Subject: [ruby-core:116668] [Ruby master Bug#20256] Make required ASAN settings "built in" without the need for ASAN_OPTIONS env var Issue #20256 has been reported by kjtsanaktsidis (KJ Tsanaktsidis). ---------------------------------------- Bug #20256: Make required ASAN settings "built in" without the need for ASAN_OPTIONS env var https://bugs.ruby-lang.org/issues/20256 * Author: kjtsanaktsidis (KJ Tsanaktsidis) * Status: Open * Priority: Normal * Assignee: kjtsanaktsidis (KJ Tsanaktsidis) * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- Currently, to compile Ruby head with ASAN, you need to export the env var `ASAN_OPTIONS=use_sigaltstack=0:detect_leaks=0`. We require `use_sigaltstack=0` because Ruby registers signal handlers with its own sigaltstack, and we require `detect_leaks=0` because Ruby does not free all of its own memory at exit (unless the `RUBY_FREE_AT_EXIT` env var is set). It would be good if this could be "built in" to the build system so pepole do not have to remember to do this. * For the built `ruby` program itself, we can add a `__asan_default_options` function; the asan initialization routine will call this to set the asan options for the program. * We also need to patch `mkmf.rb` to set `detect_leaks=0` on test programs. The test programs get compiled with Ruby's CFLAGS, which will include `-fsanitize=address` if Ruby is compiled with asan. Then, if any of these test programs are run (like with `try_run`, which the socket extconf.rb uses), they will exit with failure status for any ASAN errors. Normally test programs don't have any invalid pointers or such, but they often don't bother to free memory at program exit, so we need to turn of asan's leak detection when executing them. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/