
Issue #20221 has been reported by leeN (David Klein). ---------------------------------------- Bug #20221: ASAN: make test-basic: un-prefixed symbol leakage https://bugs.ruby-lang.org/issues/20221 * Author: leeN (David Klein) * Status: Open * Priority: Normal * ruby -v: ruby 3.4.0dev (2024-01-29T08:16:49Z master 8bff7e996c) * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- When building and running the tests (here, test-basic) with ASAN enabled, it fails with the following message: ``` Checking leaked global symbols...leaked __odr_asan_gen_rb_cArray __odr_asan_gen_ruby_digitmap __odr_asan_gen_rb_mComparable ...snip... __odr_asan_gen_OnigEncodingASCII __odr_asan_gen_OnigEncodingUS_ASCII __odr_asan_gen_OnigEncodingUTF_8 232 un-prefixed symbols leaked ``` To reproduce: ``` shell git checkout master mkdir build && cd build CXX=clang++ CC=clang ../configure cppflags="-fsanitize=address -fno-omit-frame-pointer" optflags=-O0 LDFLAGS="-fsanitize=address -fno-omit-frame-pointer" ASAN_OPTIONS=use_sigaltstack=0:detect_leaks=0:abort_on_error=1 make ASAN_OPTIONS=use_sigaltstack=0:detect_leaks=0:abort_on_error=1 make test-basic ``` To fix: ``` diff --git a/tool/leaked-globals b/tool/leaked-globals index ee75f78d1d..9e78228274 100755 --- a/tool/leaked-globals +++ b/tool/leaked-globals @@ -79,6 +79,7 @@ next unless n.sub!(/^#{SYMBOL_PREFIX}/o, "") next if n.include?(".") next if !so and n.start_with?("___asan_") + next if n.start_with?("__odr_asan") case n when /\A(?:Init_|InitVM_|pm_|[Oo]nig|dln_|coroutine_)/ next ``` I'm not overly familiar with Ruby, so this might not be the preferred approach, but it made the issue go away for me. -- https://bugs.ruby-lang.org/