This is an archive of the discontinued LLVM Phabricator instance.

[LSAN][HWASAN] Run LSAN tests with HWASAN enabled
ClosedPublic

Authored by kstoimenov on Jan 26 2023, 4:20 PM.

Details

Summary

A lot of tests are disabled by using UNSUPPORTED. The plan is to remove UNSUPPORTED for tests that are fixed.

Diff Detail

Event Timeline

kstoimenov created this revision.Jan 26 2023, 4:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 26 2023, 4:20 PM
Herald added a subscriber: Enna1. · View Herald Transcript
kstoimenov requested review of this revision.Jan 26 2023, 4:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 26 2023, 4:20 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
kstoimenov retitled this revision from [LSAN][HWASAN] Run LSAN tests with HWASAN enabled to [LSAN][HWASAN] Run LSAN tests with HWASAN enabled.Jan 26 2023, 4:21 PM
kstoimenov edited the summary of this revision. (Show Details)
vitalybuka added inline comments.
compiler-rt/test/lsan/TestCases/Darwin/dispatch.mm
58 ↗(On Diff #492592)

These lines deserve a separate patch

compiler-rt/test/lsan/TestCases/Linux/cleanup_in_tsd_destructor.c
14

You can have multiple // UNSUPPORTED
Comment would be nice

kstoimenov edited the summary of this revision. (Show Details)

Made all unsupported.

Only one unsupported.

vitalybuka accepted this revision.Jan 27 2023, 3:10 PM
vitalybuka added inline comments.
compiler-rt/test/lsan/CMakeLists.txt
30

why if (arch STREQUAL "x86_64")?
add FIXME if it's temporarily

This revision is now accepted and ready to land.Jan 27 2023, 3:10 PM
kstoimenov marked an inline comment as done.

Added fixme.

kstoimenov added inline comments.Jan 27 2023, 3:47 PM
compiler-rt/test/lsan/CMakeLists.txt
30

Done.

This revision was landed with ongoing or failed builds.Jan 27 2023, 4:07 PM
This revision was automatically updated to reflect the committed changes.
Enna1 added a comment.EditedJan 29 2023, 9:57 PM

Hi, is there any plan to support hwasan leak check on Android? :)

hans added a subscriber: hans.Jan 30 2023, 11:31 AM

I think this broke Mac: https://green.lab.llvm.org/green/job/clang-stage1-RA/32739/

For example:

LeakSanitizer-HWAddressSanitizer-x86_64.TestCases/Darwin.dispatch.mm (from LeakSanitizer-HWAddressSanitizer-x86_64)

+ : 'RUN: at line 2'
+ /Users/buildslave/jenkins/workspace/clang-stage1-RA@2/clang-build/./bin/clang --driver-mode=g++ -O0 -arch x86_64 -stdlib=libc++ -mmacosx-version-min=10.10 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -fsanitize-hwaddress-experimental-aliasing -I/Users/buildslave/jenkins/workspace/clang-stage1-RA@2/llvm-project/compiler-rt/test/lsan/../ /Users/buildslave/jenkins/workspace/clang-stage1-RA@2/llvm-project/compiler-rt/test/lsan/TestCases/Darwin/dispatch.mm -DDISPATCH_ASYNC -o /Users/buildslave/jenkins/workspace/clang-stage1-RA@2/clang-build/tools/clang/runtime/compiler-rt-bins/test/lsan/X86_64HWAsanConfig/TestCases/Darwin/Output/dispatch.mm.tmp-async -framework Foundation
clang-17: error: unsupported option '-fsanitize=hwaddress' for target 'x86_64-apple-darwin19.5.0'
clang-17: error: invalid linker name in argument '-fuse-ld=lld'
kstoimenov reopened this revision.Jan 30 2023, 12:20 PM
This revision is now accepted and ready to land.Jan 30 2023, 12:20 PM

Added some previous fixes.

Removed Apple as it is not supported by HWASAN.

This revision was automatically updated to reflect the committed changes.

I think this broke Mac: https://green.lab.llvm.org/green/job/clang-stage1-RA/32739/

For example:

LeakSanitizer-HWAddressSanitizer-x86_64.TestCases/Darwin.dispatch.mm (from LeakSanitizer-HWAddressSanitizer-x86_64)

+ : 'RUN: at line 2'
+ /Users/buildslave/jenkins/workspace/clang-stage1-RA@2/clang-build/./bin/clang --driver-mode=g++ -O0 -arch x86_64 -stdlib=libc++ -mmacosx-version-min=10.10 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -fsanitize-hwaddress-experimental-aliasing -I/Users/buildslave/jenkins/workspace/clang-stage1-RA@2/llvm-project/compiler-rt/test/lsan/../ /Users/buildslave/jenkins/workspace/clang-stage1-RA@2/llvm-project/compiler-rt/test/lsan/TestCases/Darwin/dispatch.mm -DDISPATCH_ASYNC -o /Users/buildslave/jenkins/workspace/clang-stage1-RA@2/clang-build/tools/clang/runtime/compiler-rt-bins/test/lsan/X86_64HWAsanConfig/TestCases/Darwin/Output/dispatch.mm.tmp-async -framework Foundation
clang-17: error: unsupported option '-fsanitize=hwaddress' for target 'x86_64-apple-darwin19.5.0'
clang-17: error: invalid linker name in argument '-fuse-ld=lld'

Looks like -fsanitize=hwaddress is not supported on Mac. I re-landed this with Mac disabled. Will keep an eye on your builds.

Hi, is there any plan to support hwasan leak check on Android? :)

I am working on generic support, focusing on x86 for now. Theoretically it should work on ARM, but I haven't tried that. I am also not sure is there anything specific which needs to be done to make it work on Android on top of making it work on ARM. You can try flipping the cf.detect_leaks flag in compiler-rt/lib/hwasan/hwasan.cpp to see if it works :-)

vitalybuka added inline comments.Jan 30 2023, 2:58 PM
compiler-rt/test/lsan/CMakeLists.txt
32

We should make hwasan unsupported on lib/ level