]> granicus.if.org Git - clang/commitdiff
[ubsan] Extend default blacklist support to integer/nullability groups
authorVedant Kumar <vsk@apple.com>
Tue, 12 Sep 2017 18:58:00 +0000 (18:58 +0000)
committerVedant Kumar <vsk@apple.com>
Tue, 12 Sep 2017 18:58:00 +0000 (18:58 +0000)
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
test/Driver/Inputs/resource_dir/ubsan_blacklist.txt [new file with mode: 0644]
test/Driver/fsanitize-blacklist.c

index 6435da09f63a6d383aaf10ba245e2dd3ece4173b..a6cc67ba2aa867b81cd1fcc3971773be156f0faf 100644 (file)
@@ -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 (file)
index 0000000..e69de29
index adf776fcae73f325185689b69fde2687119bc568..9268bb2b4853d78d4a47e3e252b4ff4486912fe7 100644 (file)
 // 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