This is an archive of the discontinued LLVM Phabricator instance.

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

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

Details

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

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
55

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
55

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
mcgrathr updated this revision to Diff 356556.Jul 5 2021, 12:28 PM
mcgrathr marked an inline comment as done.

rebased

phosek added inline comments.Jul 7 2021, 1:26 PM
compiler-rt/lib/asan/asan_fuchsia.cpp
22

These extra spaces inserted between # and include seem like some formatting issue?

mcgrathr added inline comments.Jul 7 2021, 1:44 PM
compiler-rt/lib/asan/asan_fuchsia.cpp
22

clang-format as run by arc diff did that. I assumed it was an intended change to a .clang-format file or to the defaults. (One common style is one space for each level of #if nesting.)

vitalybuka added inline comments.Jul 8 2021, 2:32 PM
compiler-rt/lib/asan/asan_fuchsia.cpp
22

Correct, after D100238

Herald added a project: Restricted Project. · View Herald TranscriptMar 29 2022, 12:42 PM
Herald added a subscriber: abrachet. · View Herald Transcript
MaskRay added inline comments.
compiler-rt/lib/asan/asan_posix.cpp
18

The recommended style is to place system headers after project headers.

You may also ignore clang-format lint.

MaskRay added inline comments.Mar 29 2022, 1:13 PM
compiler-rt/lib/asan/asan_win.cpp
18

The style is to place system headers after project headers.

Consider dropping this chunk of change.

This revision was landed with ongoing or failed builds.Mar 29 2022, 5:14 PM
This revision was automatically updated to reflect the committed changes.