From f9b0137a0dafa41f6834fd25c1aebe6314091dec Mon Sep 17 00:00:00 2001 From: Maxim Ostapenko Date: Tue, 31 Jan 2017 07:15:37 +0000 Subject: [lsan] Renable LSan for x86 Linux The missed clang part was committed at https://reviews.llvm.org/rL293609 thus we can reenable LSan for x86 Linux. Differential Revision: https://reviews.llvm.org/D28609 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@293610 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../TestCases/Posix/sanitizer_set_death_callback_test.cc | 7 +++++++ test/sanitizer_common/TestCases/corelimit.cc | 2 +- test/sanitizer_common/lit.common.cfg | 3 +++ test/sanitizer_common/print_address.h | 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-) (limited to 'test/sanitizer_common') diff --git a/test/sanitizer_common/TestCases/Posix/sanitizer_set_death_callback_test.cc b/test/sanitizer_common/TestCases/Posix/sanitizer_set_death_callback_test.cc index fdb68c0cd..12a56c73e 100644 --- a/test/sanitizer_common/TestCases/Posix/sanitizer_set_death_callback_test.cc +++ b/test/sanitizer_common/TestCases/Posix/sanitizer_set_death_callback_test.cc @@ -2,6 +2,13 @@ // REQUIRES: stable-runtime +// For standalone LSan on x86 we have a problem: compiler spills the address +// of allocated at line 42 memory thus memory block allocated in Leak() function +// ends up to be classified as reachable despite the fact we zero out 'sink' at +// the last line of main function. The problem doesn't reproduce with ASan because +// quarantine prohibits memory block reuse for different allocations. +// XFAIL: lsan-x86 + #include #include diff --git a/test/sanitizer_common/TestCases/corelimit.cc b/test/sanitizer_common/TestCases/corelimit.cc index 8f54940d0..0a86e5b7b 100644 --- a/test/sanitizer_common/TestCases/corelimit.cc +++ b/test/sanitizer_common/TestCases/corelimit.cc @@ -1,5 +1,5 @@ // RUN: %clangxx -O0 %s -o %t && %run %t -// XFAIL: lsan +// UNSUPPORTED: lsan #include #include diff --git a/test/sanitizer_common/lit.common.cfg b/test/sanitizer_common/lit.common.cfg index b32fb1ba9..2926edb12 100644 --- a/test/sanitizer_common/lit.common.cfg +++ b/test/sanitizer_common/lit.common.cfg @@ -26,6 +26,9 @@ config.available_features.add(config.tool_name) if config.target_arch not in ['arm', 'armhf', 'aarch64']: config.available_features.add('stable-runtime') +if config.host_os == 'Linux' and config.target_arch == 'i386' and config.tool_name == "lsan": + config.available_features.add("lsan-x86") + if config.host_os == 'Darwin': # On Darwin, we default to `abort_on_error=1`, which would make tests run # much slower. Let's override this and run lit tests with 'abort_on_error=0'. diff --git a/test/sanitizer_common/print_address.h b/test/sanitizer_common/print_address.h index 018db6180..99261b331 100644 --- a/test/sanitizer_common/print_address.h +++ b/test/sanitizer_common/print_address.h @@ -11,6 +11,8 @@ void print_address(const char *str, int n, ...) { // On FreeBSD, the %p conversion specifier works as 0x%x and thus does not // match to the format used in the diagnotic message. fprintf(stderr, "0x%012lx ", (unsigned long) p); +#elif defined(__i386__) + fprintf(stderr, "0x%8lx ", (unsigned long) p); #elif defined(__mips64) fprintf(stderr, "0x%010lx ", (unsigned long) p); #endif -- cgit v1.2.3