<div dir="ltr">(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 :-) )</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Dec 24, 2022 at 6:48 AM Rob Landley <<a href="mailto:rob@landley.net">rob@landley.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I was trying to figure out why "ASAN=1 make test_sh" failed on the very first<br>
test, and I traced it down to the memory leak detector going "you're letting<br>
exit free memory for you!" (yes, I know?) and then wasting another hour digging<br>
through the build plumbing trying to figure out why the<br>
ASAN_OPTIONS=detect_leaks=0 that scripts/portability.sh is exporting in the ASAN<br>
case wasn't making it through to the final call to gcc *.o and...<br>
<br>
It is. The problem is that the gcc in devuan beowulf is ignoring it. This<br>
doesn't show up in most of the other toybox cases because xexit() calls _xexit()<br>
which calls _exit(). I.E. we never return through the libc plumbing error path,<br>
we do our own cleanup and call the syscall ourselves. But in sh.c, exit_main()<br>
is calling libc's exit() so in this ONE case if you explicitly "exit" from the<br>
shell, ASAN's leak detector runs.<br>
<br>
I've worked around it for now by sticking<br>
<br>
const char *__asan_default_options() { return "detect_leaks=0"; }<br>
<br>
into main.c which made it stop doing that, but WOW this is janky infrastructure.<br>
<br>
Rob<br>
_______________________________________________<br>
Toybox mailing list<br>
<a href="mailto:Toybox@lists.landley.net" target="_blank">Toybox@lists.landley.net</a><br>
<a href="http://lists.landley.net/listinfo.cgi/toybox-landley.net" rel="noreferrer" target="_blank">http://lists.landley.net/listinfo.cgi/toybox-landley.net</a><br>
</blockquote></div>