[Toybox] Debian's gcc-8 doesn't respect ASAN_OPTIONS=detect_leaks=0

enh enh at google.com
Mon Jan 9 08:59:14 PST 2023


(fyi, whenever i say "asan" [or hwasan], i mean _clang's_ unrelated
implementation. afaik none of the google asan team have touched the gcc
implementation in years, and i don't know what state that's in. whereas if
you have issues with clang+asan, i can pass those on to the authors :-) )

On Sat, Dec 24, 2022 at 6:48 AM Rob Landley <rob at landley.net> wrote:

> I was trying to figure out why "ASAN=1 make test_sh" failed on the very
> first
> test, and I traced it down to the memory leak detector going "you're
> letting
> exit free memory for you!" (yes, I know?) and then wasting another hour
> digging
> through the build plumbing trying to figure out why the
> ASAN_OPTIONS=detect_leaks=0 that scripts/portability.sh is exporting in
> the ASAN
> case wasn't making it through to the final call to gcc *.o and...
>
> It is. The problem is that the gcc in devuan beowulf is ignoring it. This
> doesn't show up in most of the other toybox cases because xexit() calls
> _xexit()
> which calls _exit(). I.E. we never return through the libc plumbing error
> path,
> we do our own cleanup and call the syscall ourselves. But in sh.c,
> exit_main()
> is calling libc's exit() so in this ONE case if you explicitly "exit" from
> the
> shell, ASAN's leak detector runs.
>
> I've worked around it for now by sticking
>
>   const char *__asan_default_options() { return "detect_leaks=0"; }
>
> into main.c which made it stop doing that, but WOW this is janky
> infrastructure.
>
> Rob
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20230109/3acc7696/attachment.htm>


More information about the Toybox mailing list