[ubsan] Enable UBsan in sanitizer_common tests

Summary:
Failing tests just marked as UNSUPPORTED or XFAIL.
Some of them can be easily supported, but I'll do this in separate patches.

Reviewers: eugenis, alekseyshl

Subscribers: srhines, kubamracek, llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D37630

llvm-svn: 312860
This commit is contained in:
Vitaly Buka 2017-09-09 06:10:58 +00:00
parent b4f2d13dc6
commit fd5960a653
25 changed files with 32 additions and 12 deletions

View File

@ -11,6 +11,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT ANDROID)
list(APPEND SUPPORTED_TOOLS tsan)
list(APPEND SUPPORTED_TOOLS msan)
list(APPEND SUPPORTED_TOOLS lsan)
list(APPEND SUPPORTED_TOOLS ubsan)
endif()
# Create a separate config for each tool we support.

View File

@ -21,6 +21,7 @@
// UNSUPPORTED: lsan
// UNSUPPORTED: msan
// UNSUPPORTED: tsan
// UNSUPPORTED: ubsan
#include <signal.h>
#include <stdio.h>

View File

@ -7,6 +7,7 @@
// XFAIL: msan
// XFAIL: lsan
// XFAIL: tsan
// XFAIL: ubsan
#include <assert.h>
#include <stdio.h>
#include <sanitizer/asan_interface.h>

View File

@ -57,5 +57,6 @@ int main(void) {
// CHECK-tsan: rw-p {{.*}} [trace 1]
// CHECK-tsan: rw-p {{.*}} [trace header 1]
// Nothing interesting with standalone LSan.
// Nothing interesting with standalone LSan and UBSan.
// CHECK-lsan: decorate_proc_maps
// CHECK-ubsan: decorate_proc_maps

View File

@ -1,5 +1,5 @@
// RUN: %clangxx %s -o %t && %run not %t 1 2>&1 | FileCheck %s
// UNSUPPORTED: lsan, android
// UNSUPPORTED: lsan,ubsan,android
#include <dlfcn.h>
#include <stdio.h>

View File

@ -14,6 +14,7 @@
// XFAIL: lsan
// XFAIL: tsan
// XFAIL: msan
// XFAIL: ubsan
#include <string.h>
#include <stdio.h>

View File

@ -7,6 +7,7 @@
// XFAIL: msan
// XFAIL: lsan
// XFAIL: tsan
// XFAIL: ubsan
//
// FIXME: seems to fail on ARM
// REQUIRES: x86_64-target-arch

View File

@ -1,5 +1,5 @@
// RUN: %clang %s -o %t && %run %t
// XFAIL: lsan
// XFAIL: ubsan,lsan
#include <assert.h>
#include <sys/mman.h>

View File

@ -1,5 +1,5 @@
// RUN: %clangxx %s -o %t && %run %t 2>&1 | FileCheck %s
// UNSUPPORTED: android
// UNSUPPORTED: android, ubsan
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,7 +1,7 @@
// RUN: %clangxx -O0 -g %s -lutil -o %t && %run %t
// This test depends on the glibc layout of struct sem_t and checks that we
// don't leave sem_t::private uninitialized.
// UNSUPPORTED: android, lsan-x86
// UNSUPPORTED: android, lsan-x86, ubsan
#include <features.h>
#include <assert.h>
#include <semaphore.h>

View File

@ -14,6 +14,7 @@
// XFAIL: lsan
// XFAIL: tsan
// XFAIL: msan
// XFAIL: ubsan
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

View File

@ -1,6 +1,7 @@
// RUN: %clang -w -O0 %s -o %t && %run %t 2>&1 | FileCheck %s
// UNSUPPORTED: lsan
// UNSUPPORTED: msan
// UNSUPPORTED: ubsan
#include <stdio.h>
int main() {
int a;

View File

@ -11,6 +11,7 @@
// XFAIL: msan
// XFAIL: lsan
// XFAIL: tsan
// XFAIL: ubsan
volatile int *null = 0;

View File

@ -7,6 +7,7 @@
// XFAIL: msan
// XFAIL: lsan
// XFAIL: tsan
// XFAIL: ubsan
//
// FIXME: seems to fail on ARM
// REQUIRES: x86_64-target-arch

View File

@ -8,6 +8,7 @@
// 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
// XFAIL: ubsan
#include <sanitizer/common_interface_defs.h>
#include <stdio.h>

View File

@ -9,6 +9,7 @@
// XFAIL: msan
// XFAIL: lsan
// XFAIL: tsan
// XFAIL: ubsan
#include <sanitizer/common_interface_defs.h>
#include <stdio.h>

View File

@ -4,6 +4,7 @@
// Hooks are not implemented for lsan.
// XFAIL: lsan
// XFAIL: ubsan
#include <string.h>
#include <assert.h>

View File

@ -1,5 +1,5 @@
// RUN: %clangxx -O0 %s -o %t && %run %t
// UNSUPPORTED: lsan
// UNSUPPORTED: lsan,ubsan
#include <assert.h>
#include <sys/time.h>

View File

@ -2,6 +2,7 @@
// Malloc/free hooks are not supported on Windows.
// XFAIL: win32
// XFAIL: ubsan
#include <stdlib.h>
#include <unistd.h>

View File

@ -1,4 +1,5 @@
// RUN: %clangxx -O0 %s -o %t
// UNSUPPORTED: ubsan
// Recursive include: options1 includes options2
// RUN: echo "symbolize=1" > %t.options1.txt

View File

@ -4,6 +4,7 @@
// RUN: %env_tool_opts=symbolize_inline_frames=false:stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s --check-prefix=NOINLINE
// UNSUPPORTED: darwin
// XFAIL: ubsan
#include <sanitizer/common_interface_defs.h>

View File

@ -2,7 +2,7 @@
//
// REQUIRES: has_sancovcc,stable-runtime
// UNSUPPORTED: i386-darwin
// XFAIL: tsan
// XFAIL: ubsan,tsan
//
// RUN: %clangxx -O0 %s -S -o - -emit-llvm -fsanitize-coverage=trace-pc,bb,no-prune 2>&1 | grep "call void @__sanitizer_cov_trace_pc" | count 3
// RUN: %clangxx -O0 %s -S -o - -emit-llvm -fsanitize-coverage=trace-pc,bb 2>&1 | grep "call void @__sanitizer_cov_trace_pc" | count 2

View File

@ -1,6 +1,7 @@
// Tests trace pc guard coverage collection.
//
// REQUIRES: has_sancovcc,stable-runtime
// UNSUPPORTED: ubsan
// XFAIL: tsan,darwin,powerpc64,s390x,mips
//
// RUN: DIR=%t_workdir
@ -68,5 +69,5 @@ int baz() {
//
// CHECK-SANCOV: Ignoring {{.*}}_1.so and its coverage because __sanitizer_cov* functions were not found.
// CHECK-SANCOV: Ignoring {{.*}}_2.so and its coverage because __sanitizer_cov* functions were not found.
// CHECK-SANCOV-NEXT: sanitizer_coverage_trace_pc_guard-dso.cc:29 foo
// CHECK-SANCOV-NEXT: sanitizer_coverage_trace_pc_guard-dso.cc:34 main
// CHECK-SANCOV-NEXT: sanitizer_coverage_trace_pc_guard-dso.cc:[[@LINE-42]] foo
// CHECK-SANCOV-NEXT: sanitizer_coverage_trace_pc_guard-dso.cc:[[@LINE-38]] main

View File

@ -1,7 +1,7 @@
// Tests trace pc guard coverage collection.
//
// REQUIRES: has_sancovcc,stable-runtime
// UNSUPPORTED: i386-darwin
// UNSUPPORTED: ubsan,i386-darwin
// XFAIL: tsan,powerpc64,s390x,mips
//
// RUN: DIR=%t_workdir
@ -36,7 +36,7 @@ int main() {
// CHECK-NEXT: foo
// CHECK-NEXT: SanitizerCoverage: ./sanitizer_coverage_trace_pc_guard.{{.*}}.sancov: 2 PCs written
//
// CHECK-SANCOV: sanitizer_coverage_trace_pc_guard.cc:23 foo
// CHECK-SANCOV-NEXT: sanitizer_coverage_trace_pc_guard.cc:28 main
// CHECK-SANCOV: sanitizer_coverage_trace_pc_guard.cc:[[@LINE-16]] foo
// CHECK-SANCOV-NEXT: sanitizer_coverage_trace_pc_guard.cc:[[@LINE-12]] main
//
// CHECK-NOCOV-NOT: SanitizerCoverage

View File

@ -18,6 +18,9 @@ elif config.tool_name == "msan":
elif config.tool_name == "lsan":
tool_cflags = ["-fsanitize=leak"]
tool_options = "LSAN_OPTIONS"
elif config.tool_name == "ubsan":
tool_cflags = ["-fsanitize=undefined"]
tool_options = "UBSAN_OPTIONS"
else:
lit_config.fatal("Unknown tool for sanitizer_common tests: %r" % config.tool_name)