From efd1952be218c5b30304d1090f17a62728247e1b Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Tue, 12 Sep 2017 18:58:00 +0000 Subject: [PATCH] [ubsan] Extend default blacklist support to integer/nullability groups The default blacklist should also apply when the integer or nullability checks are enabled. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313062 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/SanitizerArgs.cpp | 2 +- test/Driver/Inputs/resource_dir/ubsan_blacklist.txt | 0 test/Driver/fsanitize-blacklist.c | 6 ++++++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 test/Driver/Inputs/resource_dir/ubsan_blacklist.txt diff --git a/lib/Driver/SanitizerArgs.cpp b/lib/Driver/SanitizerArgs.cpp index 6435da09f6..a6cc67ba2a 100644 --- a/lib/Driver/SanitizerArgs.cpp +++ b/lib/Driver/SanitizerArgs.cpp @@ -104,7 +104,7 @@ static bool getDefaultBlacklist(const Driver &D, SanitizerMask Kinds, BlacklistFile = "dfsan_abilist.txt"; else if (Kinds & CFI) BlacklistFile = "cfi_blacklist.txt"; - else if (Kinds & Undefined) + else if (Kinds & (Undefined | Integer | Nullability)) BlacklistFile = "ubsan_blacklist.txt"; if (BlacklistFile) { diff --git a/test/Driver/Inputs/resource_dir/ubsan_blacklist.txt b/test/Driver/Inputs/resource_dir/ubsan_blacklist.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/Driver/fsanitize-blacklist.c b/test/Driver/fsanitize-blacklist.c index adf776fcae..9268bb2b48 100644 --- a/test/Driver/fsanitize-blacklist.c +++ b/test/Driver/fsanitize-blacklist.c @@ -23,6 +23,12 @@ // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-BLACKLIST --implicit-check-not=fdepfile-entry // CHECK-DEFAULT-BLACKLIST: -fsanitize-blacklist={{.*}}asan_blacklist.txt +// RUN: %clang -target x86_64-linux-gnu -fsanitize=integer -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLACKLIST --implicit-check-not=fdepfile-entry +// RUN: %clang -target x86_64-linux-gnu -fsanitize=nullability -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLACKLIST --implicit-check-not=fdepfile-entry +// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLACKLIST --implicit-check-not=fdepfile-entry +// RUN: %clang -target x86_64-linux-gnu -fsanitize=alignment -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLACKLIST --implicit-check-not=fdepfile-entry +// CHECK-DEFAULT-UBSAN-BLACKLIST: -fsanitize-blacklist={{.*}}ubsan_blacklist.txt + // Ignore -fsanitize-blacklist flag if there is no -fsanitize flag. // RUN: %clang -target x86_64-linux-gnu -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE --check-prefix=DELIMITERS // CHECK-NO-SANITIZE-NOT: -fsanitize-blacklist -- 2.40.0