Page MenuHomePhabricator

[lsan] On Fuchsia, don't use atexit hook for leak checks
AcceptedPublic

Authored by mcgrathr on Sep 24 2020, 10:42 AM.

Details

Reviewers
phosek
vitalybuka
Summary

This is a re-land of https://reviews.llvm.org/D86171 with fix.

Fuchsia's system libraries are instrumented and use the lsan
allocator for internal purposes. So leak checking needs to run
after all atexit hooks and after the system libraries' internal
exit-time hooks. The <zircon/sanitizer.h> hook API calls the
__sanitizer_process_exit_hook function at exactly the right time.

Diff Detail

Unit TestsFailed

TimeTest
24,480 mslinux > LLVM.Bindings/Go::go.test
Script: -- : 'RUN: at line 1'; /mnt/disks/ssd0/agent/llvm-project/build/bin/llvm-go go=/usr/bin/go test llvm.org/llvm/bindings/go/llvm

Event Timeline

mcgrathr created this revision.Sep 24 2020, 10:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 24 2020, 10:42 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
mcgrathr requested review of this revision.Sep 24 2020, 10:42 AM

This is the same as the reverted change except it always defines InstallAtExitCheckLeaks in asan_posix.cpp, just with an empty body on systems without lsan support.

Arfrever added inline comments.
compiler-rt/lib/lsan/lsan_common_fuchsia.cpp
54

The same typo again: s/asan_fuchsiap.cpp/asan_fuchsia.cpp/

mcgrathr updated this revision to Diff 294397.Sep 25 2020, 12:12 PM

fix typo and missing #include

mcgrathr marked an inline comment as done.Sep 25 2020, 12:13 PM
mcgrathr added inline comments.
compiler-rt/lib/lsan/lsan_common_fuchsia.cpp
54

Fixed again, thanks!

vitalybuka accepted this revision.Feb 17 2021, 1:57 PM
This revision is now accepted and ready to land.Feb 17 2021, 1:57 PM