Actions
Bug #20256
closedMake required ASAN settings "built in" without the need for ASAN_OPTIONS env var
Description
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 setdetect_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 withtry_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.
Actions
Like0
Like0