Skip to content

Commit f9a0163

Browse files
committed
[LSAN][HWASAN] Run LSAN tests with HWASAN enabled
A lot of tests are disabled by using UNSUPPORTED. The plan is to remove UNSUPPORTED for tests that are fixed. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D142676
1 parent 9000a36 commit f9a0163

36 files changed

+129
-4
lines changed

compiler-rt/test/lsan/CMakeLists.txt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
set(LSAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
22

33
set(LSAN_TESTSUITES)
4-
4+
55
set(LSAN_TEST_ARCH ${LSAN_SUPPORTED_ARCH})
66
if(APPLE)
77
darwin_filter_host_archs(LSAN_SUPPORTED_ARCH LSAN_TEST_ARCH)
@@ -12,21 +12,31 @@ foreach(arch ${LSAN_TEST_ARCH})
1212
string(TOLOWER "-${arch}" LSAN_TEST_CONFIG_SUFFIX)
1313
get_test_cc_for_arch(${arch} LSAN_TEST_TARGET_CC LSAN_TEST_TARGET_CFLAGS)
1414
string(TOUPPER ${arch} ARCH_UPPER_CASE)
15+
1516
set(LSAN_LIT_TEST_MODE "Standalone")
1617
set(CONFIG_NAME ${ARCH_UPPER_CASE}LsanConfig)
17-
1818
configure_lit_site_cfg(
1919
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
2020
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py)
2121
list(APPEND LSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
2222

2323
set(CONFIG_NAME ${ARCH_UPPER_CASE}AsanConfig)
2424
set(LSAN_LIT_TEST_MODE "AddressSanitizer")
25-
2625
configure_lit_site_cfg(
2726
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
2827
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py)
2928
list(APPEND LSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
29+
30+
# Fixme: make this generic 64 bit check once confirmed that at least
31+
# ARM64 works.
32+
if (arch STREQUAL "x86_64")
33+
set(CONFIG_NAME ${ARCH_UPPER_CASE}HWAsanConfig)
34+
set(LSAN_LIT_TEST_MODE "HWAddressSanitizer")
35+
configure_lit_site_cfg(
36+
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
37+
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py)
38+
list(APPEND LSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
39+
endif()
3040
endforeach()
3141

3242
set(LSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// Regression test for thread lifetime tracking. Thread data should be
22
// considered live during the thread's termination, at least until the
3+
4+
// Fixme: remove once test passes with hwasan
5+
// UNSUPPORTED: hwasan
36
// user-installed TSD destructors have finished running (since they may contain
47
// additional cleanup tasks). LSan doesn't actually meet that goal 100%, but it
58
// makes its best effort.

compiler-rt/test/lsan/TestCases/Linux/disabler_in_tsd_destructor.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// RUN: %clang_lsan %s -o %t
33
// RUN: %env_lsan_opts="report_objects=1:use_registers=0:use_stacks=0:use_tls=1:use_ld_allocations=0" %run %t
44

5+
// Fixme: remove once test passes with hwasan
6+
// UNSUPPORTED: hwasan
7+
58
#include <assert.h>
69
#include <pthread.h>
710
#include <stdio.h>

compiler-rt/test/lsan/TestCases/Linux/fork_threaded.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
// RUN: %clangxx_lsan %s -o %t
44
// RUN: %run %t 2>&1
55

6+
// Fixme: remove once test passes with hwasan
7+
// UNSUPPORTED: hwasan
8+
69
#include <assert.h>
710
#include <pthread.h>
811
#include <stdio.h>

compiler-rt/test/lsan/TestCases/Linux/guard-page.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Check that if LSan finds that SP doesn't point into thread stack (e.g.
22
// if swapcontext is used), LSan will not hit the guard page.
33
// RUN: %clang_lsan %s -o %t && %run %t
4+
5+
// Fixme: remove once test passes with hwasan
6+
// UNSUPPORTED: hwasan
47
// Missing 'getcontext' and 'makecontext' on Android.
58
// UNSUPPORTED: android
69

compiler-rt/test/lsan/TestCases/Linux/libdl_deadlock.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// where lsan would call dl_iterate_phdr while holding the allocator lock.
33
// RUN: %clangxx_lsan %s -o %t && %run %t
44

5+
// Fixme: remove once test passes with hwasan
6+
// UNSUPPORTED: hwasan
7+
58
#include <link.h>
69
#include <mutex>
710
#include <stdlib.h>

compiler-rt/test/lsan/TestCases/Linux/log-path_test.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
// RUN: %clangxx_lsan %s -o %t
2+
3+
// Fixme: remove once test passes with hwasan
4+
// UNSUPPORTED: hwasan
25
// The globs below do not work in the lit shell.
36

47
// Regular run.

compiler-rt/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_tls=1" %run %t 2>&1
55
// RUN: %env_lsan_opts="" %run %t 2>&1
66

7+
// Fixme: remove once test passes with hwasan
8+
// UNSUPPORTED: hwasan
9+
710
// Investigate why it does not fail with use_tls=0
811
// UNSUPPORTED: arm-linux || armhf-linux
912

compiler-rt/test/lsan/TestCases/Linux/use_tls_pthread_specific_static.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_tls=1" %run %t 2>&1
55
// RUN: %env_lsan_opts="" %run %t 2>&1
66

7+
// Fixme: remove once test passes with hwasan
8+
// UNSUPPORTED: hwasan
9+
710
#include <assert.h>
811
#include <pthread.h>
912
#include <stdio.h>

compiler-rt/test/lsan/TestCases/Linux/use_tls_static.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_tls=1" %run %t 2>&1
55
// RUN: %env_lsan_opts="" %run %t 2>&1
66

7+
// Fixme: remove once test passes with hwasan
8+
// UNSUPPORTED: hwasan
9+
710
#include <stdio.h>
811
#include <stdlib.h>
912
#include "sanitizer_common/print_address.h"

compiler-rt/test/lsan/TestCases/default_options.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// RUN: %clangxx_lsan -O2 %s -o %t && %run %t 2>&1 | FileCheck %s
22

3+
// Fixme: remove once test passes with hwasan
4+
// UNSUPPORTED: hwasan
5+
36
extern "C"
47
const char *__lsan_default_options() {
58
// CHECK: Available flags for {{Leak|Address}}Sanitizer:

compiler-rt/test/lsan/TestCases/disabler.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// RUN: %clang_lsan %s -o %t
33
// RUN: %env_lsan_opts=report_objects=1:use_registers=0:use_stacks=0:use_tls=0 not %run %t 2>&1 | FileCheck %s
44

5+
// Fixme: remove once test passes with hwasan
6+
// UNSUPPORTED: hwasan
7+
58
// Investigate why it does not fail with use_tls=0
69
// UNSUPPORTED: arm-linux || armhf-linux
710

compiler-rt/test/lsan/TestCases/do_leak_check_override.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// Test for __lsan_do_leak_check(). We test it by making the leak check run
22
// before global destructors, which also tests compatibility with HeapChecker's
3+
4+
// Fixme: remove once test passes with hwasan
5+
// UNSUPPORTED: hwasan
36
// "normal" mode (LSan runs in "strict" mode by default).
47
// RUN: %clangxx_lsan %s -o %t
58
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0 not %run %t 2>&1 | FileCheck --check-prefix=CHECK-strict %s

compiler-rt/test/lsan/TestCases/high_allocator_contention.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// Usage: ./a.out number_of_threads total_number_of_allocations
33
// RUN: %clangxx_lsan %s -o %t
44
// RUN: %env_lsan_opts=use_ld_allocations=0 %run %t 5 1000000 2>&1
5+
6+
// Fixme: remove once test passes with hwasan
7+
// UNSUPPORTED: hwasan
58
#include <assert.h>
69
#include <pthread.h>
710
#include <stdlib.h>

compiler-rt/test/lsan/TestCases/ignore_object.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// RUN: %clang_lsan %s -o %t
33
// RUN: %env_lsan_opts=report_objects=1:use_registers=0:use_stacks=0:use_tls=0 not %run %t 2>&1 | FileCheck %s
44

5+
// Fixme: remove once test passes with hwasan
6+
// UNSUPPORTED: hwasan
7+
58
// Investigate why it does not fail with use_stack=0
69
// UNSUPPORTED: arm-linux || armhf-linux
710

compiler-rt/test/lsan/TestCases/leak_check_at_exit.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0:leak_check_at_exit=0 not %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-do
66
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0:leak_check_at_exit=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont
77

8+
// Fixme: remove once test passes with hwasan
9+
// UNSUPPORTED: hwasan
10+
811
#include <stdio.h>
912
#include <stdlib.h>
1013
#include <sanitizer/lsan_interface.h>

compiler-rt/test/lsan/TestCases/link_turned_off.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// RUN: %clangxx_lsan %s -o %t
33
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0 %run %t
44
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0 not %run %t foo 2>&1 | FileCheck %s
5+
6+
// Fixme: remove once test passes with hwasan
7+
// UNSUPPORTED: hwasan
58
//
69
// UNSUPPORTED: darwin
710

compiler-rt/test/lsan/TestCases/malloc_zero.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// RUN: %clang_lsan %s -o %t
22
// RUN: %env_lsan_opts=use_stacks=0 not %run %t 2>&1 | FileCheck %s
33

4+
// Fixme: remove once test passes with hwasan
5+
// UNSUPPORTED: hwasan
6+
47
/// Fails when only leak sanitizer is enabled
58
// UNSUPPORTED: arm-linux, armhf-linux
69

compiler-rt/test/lsan/TestCases/many_tls_keys_pthread.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_tls=1" %run %t 2>&1
55
// RUN: %env_lsan_opts="" %run %t 2>&1
66

7+
// Fixme: remove once test passes with hwasan
8+
// UNSUPPORTED: hwasan
9+
710
// On glibc, this requires the range returned by GetTLS to include
811
// specific_1stblock and specific in `struct pthread`.
912
// UNSUPPORTED: arm-linux, armhf-linux

compiler-rt/test/lsan/TestCases/many_tls_keys_thread.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_tls=1" %run %t 2>&1
55
// RUN: %env_lsan_opts="" %run %t 2>&1
66

7+
// Fixme: remove once test passes with hwasan
8+
// UNSUPPORTED: hwasan
9+
710
// Patch r303906 did not fix all the problems.
811
// UNSUPPORTED: arm-linux,armhf-linux
912

compiler-rt/test/lsan/TestCases/pointer_to_self.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
// RUN: %clangxx_lsan %s -o %t
44
// RUN: %env_lsan_opts="report_objects=1:use_registers=0:use_stacks=0" not %run %t 2>&1 | FileCheck %s
55

6+
// Fixme: remove once test passes with hwasan
7+
// UNSUPPORTED: hwasan
8+
69
#include <stdio.h>
710
#include <stdlib.h>
811
#include "sanitizer_common/print_address.h"

compiler-rt/test/lsan/TestCases/realloc_too_big.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// RUN: %clang_lsan %s -o %t
22
// RUN: %env_lsan_opts=allocator_may_return_null=1:max_allocation_size_mb=1:use_stacks=0 not %run %t 2>&1 | FileCheck %s
33

4+
// Fixme: remove once test passes with hwasan
5+
// UNSUPPORTED: hwasan
6+
47
/// Fails when only leak sanitizer is enabled
58
// UNSUPPORTED: arm-linux, armhf-linux
69

compiler-rt/test/lsan/TestCases/recoverable_leak_check.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// RUN: %clangxx_lsan %s -o %t
33
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0 %run %t foo 2>&1 | FileCheck %s
44
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0 %run %t 2>&1 | FileCheck %s
5+
6+
// Fixme: remove once test passes with hwasan
7+
// UNSUPPORTED: hwasan
58
//
69
// UNSUPPORTED: darwin
710

compiler-rt/test/lsan/TestCases/register_root_region.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0 not %run %t foo 2>&1 | FileCheck %s
55
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0:use_root_regions=0 not %run %t 2>&1 | FileCheck %s
66

7+
// Fixme: remove once test passes with hwasan
8+
// UNSUPPORTED: hwasan
9+
710
#include <assert.h>
811
#include <stdio.h>
912
#include <stdlib.h>

compiler-rt/test/lsan/TestCases/suppressions_default.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// RUN: %clangxx_lsan %s -o %t
22
// RUN: %env_lsan_opts=use_registers=0:use_stacks=0 not %run %t 2>&1 | FileCheck %s
33

4+
// Fixme: remove once test passes with hwasan
5+
// UNSUPPORTED: hwasan
6+
47
#include <stdio.h>
58
#include <stdlib.h>
69

compiler-rt/test/lsan/TestCases/suppressions_file.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// RUN: %clangxx_lsan %s -o %t
22

3+
// Fixme: remove once test passes with hwasan
4+
// UNSUPPORTED: hwasan
5+
36
// RUN: rm -f %t.supp
47
// RUN: touch %t.supp
58
// RUN: %push_to_device %t.supp %device_rundir/%t.supp

compiler-rt/test/lsan/TestCases/swapcontext.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// We can't unwind stack if we're running coroutines on heap-allocated
22
// memory. Make sure we don't report these leaks.
33

4+
// Fixme: remove once test passes with hwasan
5+
// UNSUPPORTED: hwasan
6+
47
// RUN: %clangxx_lsan %s -o %t
58
// RUN: %env_lsan_opts= %run %t 2>&1
69
// RUN: %env_lsan_opts= not %run %t foo 2>&1 | FileCheck %s

compiler-rt/test/lsan/TestCases/use_after_return.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=1 %env_lsan_opts="report_objects=1:use_registers=0:use_stacks=1" %run %t 2>&1
66
// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=1 %env_lsan_opts="" %run %t 2>&1
77

8+
// Fixme: remove once test passes with hwasan
9+
// UNSUPPORTED: hwasan
10+
811
// Investigate why it does not fail with use_stack=0
912
// UNSUPPORTED: arm-linux || armhf-linux
1013

compiler-rt/test/lsan/TestCases/use_globals_initialized.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_globals=1" %run %t 2>&1
55
// RUN: %env_lsan_opts="" %run %t 2>&1
66

7+
// Fixme: remove once test passes with hwasan
8+
// UNSUPPORTED: hwasan
9+
710
#include <stdio.h>
811
#include <stdlib.h>
912
#include "sanitizer_common/print_address.h"

compiler-rt/test/lsan/TestCases/use_globals_uninitialized.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_globals=1" %run %t 2>&1
55
// RUN: %env_lsan_opts="" %run %t 2>&1
66

7+
// Fixme: remove once test passes with hwasan
8+
// UNSUPPORTED: hwasan
9+
710
#include <stdio.h>
811
#include <stdlib.h>
912
#include "sanitizer_common/print_address.h"

compiler-rt/test/lsan/TestCases/use_registers.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=1" %run %t 2>&1
55
// RUN: %env_lsan_opts="" %run %t 2>&1
66

7+
// Fixme: remove once test passes with hwasan
8+
// UNSUPPORTED: hwasan
9+
710
#include "sanitizer_common/print_address.h"
811
#include <assert.h>
912
#include <pthread.h>

compiler-rt/test/lsan/TestCases/use_registers_extra.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=1" %run %t 2>&1
55
// RUN: %env_lsan_opts="" %run %t 2>&1
66

7+
// Fixme: remove once test passes with hwasan
8+
// UNSUPPORTED: hwasan
9+
710
// FIXME: Support more platforms.
811
// REQUIRES: x86-target-arch && linux
912

compiler-rt/test/lsan/TestCases/use_stacks.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// RUN: %env_lsan_opts="report_objects=1:use_registers=0:use_stacks=1" %run %t 2>&1
55
// RUN: %env_lsan_opts="" %run %t 2>&1
66

7+
// Fixme: remove once test passes with hwasan
8+
// UNSUPPORTED: hwasan
9+
710
#include <stdio.h>
811
#include <stdlib.h>
912
#include "sanitizer_common/print_address.h"

compiler-rt/test/lsan/TestCases/use_stacks_threaded.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// RUN: %env_lsan_opts="report_objects=1:use_registers=0:use_stacks=1" %run %t 2>&1
55
// RUN: %env_lsan_opts="" %run %t 2>&1
66

7+
// Fixme: remove once test passes with hwasan
8+
// UNSUPPORTED: hwasan
9+
710
#include <assert.h>
811
#include <pthread.h>
912
#include <sched.h>

compiler-rt/test/lsan/TestCases/use_unaligned.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_unaligned=0" not %run %t 2>&1 | FileCheck %s
44
// RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_unaligned=1" %run %t 2>&1
55

6+
// Fixme: remove once test passes with hwasan
7+
// UNSUPPORTED: hwasan
8+
69
#include <stdio.h>
710
#include <stdlib.h>
811
#include <string.h>

0 commit comments

Comments
 (0)