diff --git a/clang/include/clang/Basic/DiagnosticASTKinds.td b/clang/include/clang/Basic/DiagnosticASTKinds.td --- a/clang/include/clang/Basic/DiagnosticASTKinds.td +++ b/clang/include/clang/Basic/DiagnosticASTKinds.td @@ -565,8 +565,8 @@ def remark_sanitize_address_insert_extra_padding_rejected : Remark< "-fsanitize-address-field-padding ignored for %0 because it " "%select{is not C++|is packed|is a union|is trivially copyable|" - "has trivial destructor|is standard layout|is in a blacklisted file|" - "is blacklisted}1">, ShowInSystemHeader, + "has trivial destructor|is standard layout|is in a blocklisted file|" + "is blocklisted}1">, ShowInSystemHeader, InGroup; def warn_npot_ms_struct : Warning< diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1429,15 +1429,29 @@ "or suspicious behavior. See user manual for available checks">; def fno_sanitize_EQ : CommaJoined<["-"], "fno-sanitize=">, Group, Flags<[CoreOption, NoXarchOption]>; -def fsanitize_blacklist : Joined<["-"], "fsanitize-blacklist=">, +def fsanitize_blocklist : Joined<["-"], "fsanitize-blocklist=">, Group, - HelpText<"Path to blacklist file for sanitizers">; -def fsanitize_system_blacklist : Joined<["-"], "fsanitize-system-blacklist=">, - HelpText<"Path to system blacklist file for sanitizers">, + HelpText<"Path to blocklist file for sanitizers">, + MarshallingInfoStringVector>; +def fsanitize_blacklist : Joined<["-"], "fsanitize-blacklist=">, + Group, Alias, + Flags<[HelpHidden]>, + HelpText<"Deprecated, use -fsanitize-blocklist= instead">; +def fsanitize_system_blocklist : Joined<["-"], "fsanitize-system-blocklist=">, + Group, + HelpText<"Path to system blocklist file for sanitizers">, Flags<[CC1Option]>; -def fno_sanitize_blacklist : Flag<["-"], "fno-sanitize-blacklist">, +def fsanitize_system_blacklist : Joined<["-"], "fsanitize-system-blacklist=">, + Group, Alias, + Flags<[CC1Option, HelpHidden]>, + HelpText<"Deprecated, use -fsanitize-system-blocklist= instead">; +def fno_sanitize_blocklist : Flag<["-"], "fno-sanitize-blocklist">, Group, - HelpText<"Don't use blacklist file for sanitizers">; + HelpText<"Don't use blocklist file for sanitizers">; +def fno_sanitize_blacklist : Flag<["-"], "fno-sanitize-blacklist">, + Group, + Flags<[HelpHidden]>, + HelpText<"Deprecated, use -fno-sanitize-blocklist= instead">; def fsanitize_coverage : CommaJoined<["-"], "fsanitize-coverage=">, Group, diff --git a/clang/include/clang/Frontend/DependencyOutputOptions.h b/clang/include/clang/Frontend/DependencyOutputOptions.h --- a/clang/include/clang/Frontend/DependencyOutputOptions.h +++ b/clang/include/clang/Frontend/DependencyOutputOptions.h @@ -22,7 +22,7 @@ /// ExtraDepKind - The kind of extra dependency file. enum ExtraDepKind { - EDK_SanitizeBlacklist, + EDK_SanitizeBlocklist, EDK_ProfileList, EDK_ModuleFile, EDK_DepFileEntry, diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -539,7 +539,7 @@ DynamicThisUseChecker(const ASTContext &C) : super(C), UsesThis(false) {} - // Black-list all explicit and implicit references to 'this'. + // Record all explicit and implicit references to 'this'. // // Do we need to worry about external references to 'this' derived // from arbitrary code? If so, then anything which runs arbitrary diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp --- a/clang/lib/Driver/SanitizerArgs.cpp +++ b/clang/lib/Driver/SanitizerArgs.cpp @@ -138,14 +138,14 @@ struct Blacklist { const char *File; SanitizerMask Mask; - } Blacklists[] = {{"asan_blacklist.txt", SanitizerKind::Address}, - {"hwasan_blacklist.txt", SanitizerKind::HWAddress}, - {"memtag_blacklist.txt", SanitizerKind::MemTag}, - {"msan_blacklist.txt", SanitizerKind::Memory}, - {"tsan_blacklist.txt", SanitizerKind::Thread}, + } Blacklists[] = {{"asan_blocklist.txt", SanitizerKind::Address}, + {"hwasan_blocklist.txt", SanitizerKind::HWAddress}, + {"memtag_blocklist.txt", SanitizerKind::MemTag}, + {"msan_blocklist.txt", SanitizerKind::Memory}, + {"tsan_blocklist.txt", SanitizerKind::Thread}, {"dfsan_abilist.txt", SanitizerKind::DataFlow}, - {"cfi_blacklist.txt", SanitizerKind::CFI}, - {"ubsan_blacklist.txt", + {"cfi_blocklist.txt", SanitizerKind::CFI}, + {"ubsan_blocklist.txt", SanitizerKind::Undefined | SanitizerKind::Integer | SanitizerKind::Nullability | SanitizerKind::FloatDivideByZero}}; @@ -581,17 +581,17 @@ TrappingKinds &= Kinds; RecoverableKinds &= ~TrappingKinds; - // Setup blacklist files. - // Add default blacklist from resource directory for activated sanitizers, and + // Setup blocklist files. + // Add default blocklist from resource directory for activated sanitizers, and // validate special case lists format. - if (!Args.hasArgNoClaim(options::OPT_fno_sanitize_blacklist)) + if (!Args.hasArgNoClaim(options::OPT_fno_sanitize_blocklist)) addDefaultBlacklists(D, Kinds, SystemBlacklistFiles); - // Parse -f(no-)?sanitize-blacklist options. + // Parse -f(no-)?sanitize-blocklist options. // This also validates special case lists format. parseSpecialCaseListArg(D, Args, UserBlacklistFiles, - options::OPT_fsanitize_blacklist, - options::OPT_fno_sanitize_blacklist, + options::OPT_fsanitize_blocklist, + options::OPT_fno_sanitize_blocklist, clang::diag::err_drv_malformed_sanitizer_blacklist); // Parse -f[no-]sanitize-memory-track-origins[=level] options. @@ -746,7 +746,7 @@ CoverageFeatures |= CoverageFunc; } - // Parse -fsanitize-coverage-(black|white)list options if coverage enabled. + // Parse -fsanitize-coverage-(block|white)list options if coverage enabled. // This also validates special case lists format. // Here, OptSpecifier() acts as a never-matching command-line argument. // So, there is no way to clear coverage lists but you can append to them. @@ -1011,9 +1011,9 @@ Args.MakeArgString("-fsanitize-trap=" + toString(TrapSanitizers))); addSpecialCaseListOpt(Args, CmdArgs, - "-fsanitize-blacklist=", UserBlacklistFiles); + "-fsanitize-blocklist=", UserBlacklistFiles); addSpecialCaseListOpt(Args, CmdArgs, - "-fsanitize-system-blacklist=", SystemBlacklistFiles); + "-fsanitize-system-blocklist=", SystemBlacklistFiles); if (MsanTrackOrigins) CmdArgs.push_back(Args.MakeArgString("-fsanitize-memory-track-origins=" + diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1966,8 +1966,8 @@ for (const auto &Dep : Opts.ExtraDeps) { switch (Dep.second) { - case EDK_SanitizeBlacklist: - // Sanitizer blacklist arguments are generated from LanguageOptions. + case EDK_SanitizeBlocklist: + // Sanitizer blocklist arguments are generated from LanguageOptions. continue; case EDK_ModuleFile: // Module file arguments are generated from FrontendOptions and @@ -2016,20 +2016,20 @@ Opts.ShowIncludesDest = ShowIncludesDestination::None; } - // Add sanitizer blacklists as extra dependencies. + // Add sanitizer blocklists as extra dependencies. // They won't be discovered by the regular preprocessor, so // we let make / ninja to know about this implicit dependency. - if (!Args.hasArg(OPT_fno_sanitize_blacklist)) { - for (const auto *A : Args.filtered(OPT_fsanitize_blacklist)) { + if (!Args.hasArg(OPT_fno_sanitize_blocklist)) { + for (const auto *A : Args.filtered(OPT_fsanitize_blocklist)) { StringRef Val = A->getValue(); if (Val.find('=') == StringRef::npos) - Opts.ExtraDeps.emplace_back(std::string(Val), EDK_SanitizeBlacklist); + Opts.ExtraDeps.emplace_back(std::string(Val), EDK_SanitizeBlocklist); } if (Opts.IncludeSystemHeaders) { - for (const auto *A : Args.filtered(OPT_fsanitize_system_blacklist)) { + for (const auto *A : Args.filtered(OPT_fsanitize_system_blocklist)) { StringRef Val = A->getValue(); if (Val.find('=') == StringRef::npos) - Opts.ExtraDeps.emplace_back(std::string(Val), EDK_SanitizeBlacklist); + Opts.ExtraDeps.emplace_back(std::string(Val), EDK_SanitizeBlocklist); } } } @@ -3457,9 +3457,9 @@ for (StringRef Sanitizer : serializeSanitizerKinds(Opts.Sanitize)) GenerateArg(Args, OPT_fsanitize_EQ, Sanitizer, SA); - // Conflating '-fsanitize-system-blacklist' and '-fsanitize-blacklist'. + // Conflating '-fsanitize-system-blocklist' and '-fsanitize-blocklist'. for (const std::string &F : Opts.NoSanitizeFiles) - GenerateArg(Args, OPT_fsanitize_blacklist, F, SA); + GenerateArg(Args, OPT_fsanitize_blocklist, F, SA); if (Opts.getClangABICompat() == LangOptions::ClangABI::Ver3_8) GenerateArg(Args, OPT_fclang_abi_compat_EQ, "3.8", SA); @@ -3857,11 +3857,11 @@ // Parse -fsanitize= arguments. parseSanitizerKinds("-fsanitize=", Args.getAllArgValues(OPT_fsanitize_EQ), Diags, Opts.Sanitize); - Opts.NoSanitizeFiles = Args.getAllArgValues(OPT_fsanitize_blacklist); - std::vector systemBlacklists = - Args.getAllArgValues(OPT_fsanitize_system_blacklist); + Opts.NoSanitizeFiles = Args.getAllArgValues(OPT_fsanitize_blocklist); + std::vector systemBlocklists = + Args.getAllArgValues(OPT_fsanitize_system_blocklist); Opts.NoSanitizeFiles.insert(Opts.NoSanitizeFiles.end(), - systemBlacklists.begin(), systemBlacklists.end()); + systemBlocklists.begin(), systemBlocklists.end()); if (Arg *A = Args.getLastArg(OPT_fclang_abi_compat_EQ)) { Opts.setClangABICompat(LangOptions::ClangABI::Latest); diff --git a/clang/test/CodeGen/asan-globals.cpp b/clang/test/CodeGen/asan-globals.cpp --- a/clang/test/CodeGen/asan-globals.cpp +++ b/clang/test/CodeGen/asan-globals.cpp @@ -1,11 +1,11 @@ // RUN: echo "int extra_global;" > %t.extra-source.cpp // RUN: echo "global:*blacklisted_global*" > %t.blacklist -// RUN: %clang_cc1 -include %t.extra-source.cpp -fsanitize=address -fsanitize-blacklist=%t.blacklist -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,ASAN -// RUN: %clang_cc1 -include %t.extra-source.cpp -fsanitize=kernel-address -fsanitize-blacklist=%t.blacklist -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,KASAN +// RUN: %clang_cc1 -include %t.extra-source.cpp -fsanitize=address -fsanitize-blocklist=%t.blacklist -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,ASAN +// RUN: %clang_cc1 -include %t.extra-source.cpp -fsanitize=kernel-address -fsanitize-blocklist=%t.blacklist -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,KASAN // The blacklist file uses regexps, so Windows path backslashes. // RUN: echo "src:%s" | sed -e 's/\\/\\\\/g' > %t.blacklist-src -// RUN: %clang_cc1 -include %t.extra-source.cpp -fsanitize=address -fsanitize-blacklist=%t.blacklist-src -emit-llvm -o - %s | FileCheck %s --check-prefix=BLACKLIST-SRC -// RUN: %clang_cc1 -include %t.extra-source.cpp -fsanitize=kernel-address -fsanitize-blacklist=%t.blacklist-src -emit-llvm -o - %s | FileCheck %s --check-prefix=BLACKLIST-SRC +// RUN: %clang_cc1 -include %t.extra-source.cpp -fsanitize=address -fsanitize-blocklist=%t.blacklist-src -emit-llvm -o - %s | FileCheck %s --check-prefix=BLACKLIST-SRC +// RUN: %clang_cc1 -include %t.extra-source.cpp -fsanitize=kernel-address -fsanitize-blocklist=%t.blacklist-src -emit-llvm -o - %s | FileCheck %s --check-prefix=BLACKLIST-SRC int global; int dyn_init_global = global; diff --git a/clang/test/CodeGen/sanitize-address-field-padding.cpp b/clang/test/CodeGen/sanitize-address-field-padding.cpp --- a/clang/test/CodeGen/sanitize-address-field-padding.cpp +++ b/clang/test/CodeGen/sanitize-address-field-padding.cpp @@ -1,9 +1,9 @@ // Test -fsanitize-address-field-padding -// RUN: echo 'type:SomeNamespace::BlacklistedByName=field-padding' > %t.type.blacklist -// RUN: echo 'src:*sanitize-address-field-padding.cpp=field-padding' > %t.file.blacklist -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsanitize=address -fsanitize-address-field-padding=1 -fsanitize-blacklist=%t.type.blacklist -Rsanitize-address -emit-llvm -o - %s 2>&1 | FileCheck %s -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsanitize=address -fsanitize-address-field-padding=1 -fsanitize-blacklist=%t.type.blacklist -Rsanitize-address -emit-llvm -o - %s -O1 -fno-experimental-new-pass-manager -mconstructor-aliases 2>&1 | FileCheck %s --check-prefix=WITH_CTOR_ALIASES -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsanitize=address -fsanitize-address-field-padding=1 -fsanitize-blacklist=%t.file.blacklist -Rsanitize-address -emit-llvm -o - %s 2>&1 | FileCheck %s --check-prefix=FILE_BLACKLIST +// RUN: echo 'type:SomeNamespace::BlocklistedByName=field-padding' > %t.type.blocklist +// RUN: echo 'src:*sanitize-address-field-padding.cpp=field-padding' > %t.file.blocklist +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsanitize=address -fsanitize-address-field-padding=1 -fsanitize-blocklist=%t.type.blocklist -Rsanitize-address -emit-llvm -o - %s 2>&1 | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsanitize=address -fsanitize-address-field-padding=1 -fsanitize-blocklist=%t.type.blocklist -Rsanitize-address -emit-llvm -o - %s -O1 -fno-experimental-new-pass-manager -mconstructor-aliases 2>&1 | FileCheck %s --check-prefix=WITH_CTOR_ALIASES +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsanitize=address -fsanitize-address-field-padding=1 -fsanitize-blocklist=%t.file.blocklist -Rsanitize-address -emit-llvm -o - %s 2>&1 | FileCheck %s --check-prefix=FILE_BLOCKLIST // RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - %s 2>&1 | FileCheck %s --check-prefix=NO_PADDING // Try to emulate -save-temps option and make sure -disable-llvm-passes will not run sanitize instrumentation. // RUN: %clang_cc1 -fsanitize=address -emit-llvm -disable-llvm-passes -o - %s | %clang_cc1 -fsanitize=address -emit-llvm -o - -x ir | FileCheck %s --check-prefix=NO_PADDING @@ -17,14 +17,13 @@ // CHECK: -fsanitize-address-field-padding ignored for Negative3 because it is a union // CHECK: -fsanitize-address-field-padding ignored for Negative4 because it is trivially copyable // CHECK: -fsanitize-address-field-padding ignored for Negative5 because it is packed -// CHECK: -fsanitize-address-field-padding ignored for SomeNamespace::BlacklistedByName because it is blacklisted +// CHECK: -fsanitize-address-field-padding ignored for SomeNamespace::BlocklistedByName because it is blocklisted // CHECK: -fsanitize-address-field-padding ignored for ExternCStruct because it is not C++ // -// FILE_BLACKLIST: -fsanitize-address-field-padding ignored for Positive1 because it is in a blacklisted file -// FILE_BLACKLIST-NOT: __asan_poison_intra_object_redzone +// FILE_BLOCKLIST: -fsanitize-address-field-padding ignored for Positive1 because it is in a blocklisted file +// FILE_BLOCKLIST-NOT: __asan_poison_intra_object_redzone // NO_PADDING-NOT: __asan_poison_intra_object_redzone - class Positive1 { public: Positive1() {} @@ -141,10 +140,10 @@ namespace SomeNamespace { -class BlacklistedByName { - public: - BlacklistedByName() {} - ~BlacklistedByName() {} +class BlocklistedByName { +public: + BlocklistedByName() {} + ~BlocklistedByName() {} int make_it_non_standard_layout; private: char private1; @@ -152,7 +151,7 @@ }; } // SomeNamespace -SomeNamespace::BlacklistedByName blacklisted_by_name; +SomeNamespace::BlocklistedByName blocklisted_by_name; extern "C" { class ExternCStruct { diff --git a/clang/test/Driver/Inputs/resource_dir/share/asan_blacklist.txt b/clang/test/Driver/Inputs/resource_dir/share/asan_blocklist.txt rename from clang/test/Driver/Inputs/resource_dir/share/asan_blacklist.txt rename to clang/test/Driver/Inputs/resource_dir/share/asan_blocklist.txt diff --git a/clang/test/Driver/Inputs/resource_dir/share/hwasan_blacklist.txt b/clang/test/Driver/Inputs/resource_dir/share/hwasan_blocklist.txt rename from clang/test/Driver/Inputs/resource_dir/share/hwasan_blacklist.txt rename to clang/test/Driver/Inputs/resource_dir/share/hwasan_blocklist.txt diff --git a/clang/test/Driver/Inputs/resource_dir/share/movit b/clang/test/Driver/Inputs/resource_dir/share/movit new file mode 100644 --- /dev/null +++ b/clang/test/Driver/Inputs/resource_dir/share/movit @@ -0,0 +1,4 @@ +git mv asan_blacklist.txt asan_blocklist.txt +git mv hwasan_blacklist.txt hwasan_blocklist.txt +git mv ubsan_blacklist.txt ubsan_blocklist.txt +git mv vtables_blacklist.txt vtables_blocklist.txt diff --git a/clang/test/Driver/Inputs/resource_dir/share/ubsan_blacklist.txt b/clang/test/Driver/Inputs/resource_dir/share/ubsan_blocklist.txt rename from clang/test/Driver/Inputs/resource_dir/share/ubsan_blacklist.txt rename to clang/test/Driver/Inputs/resource_dir/share/ubsan_blocklist.txt diff --git a/clang/test/Driver/Inputs/resource_dir/share/vtables_blacklist.txt b/clang/test/Driver/Inputs/resource_dir/share/vtables_blocklist.txt rename from clang/test/Driver/Inputs/resource_dir/share/vtables_blacklist.txt rename to clang/test/Driver/Inputs/resource_dir/share/vtables_blocklist.txt diff --git a/clang/test/Driver/fsanitize-blacklist.c b/clang/test/Driver/fsanitize-blacklist.c --- a/clang/test/Driver/fsanitize-blacklist.c +++ b/clang/test/Driver/fsanitize-blacklist.c @@ -1,4 +1,4 @@ -// General blacklist usage. +// General blocklist usage. // PR12920 // REQUIRES: clang-driver @@ -12,63 +12,63 @@ // RUN: echo "fun:bar" > %t.second // RUN: echo "badline" > %t.bad -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blacklist=%t.good -fsanitize-blacklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BLACKLIST -// RUN: %clang -target aarch64-linux-gnu -fsanitize=hwaddress -fsanitize-blacklist=%t.good -fsanitize-blacklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BLACKLIST -// CHECK-BLACKLIST: -fsanitize-blacklist={{.*}}.good" "-fsanitize-blacklist={{.*}}.second +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blocklist=%t.good -fsanitize-blocklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BLOCKLIST +// RUN: %clang -target aarch64-linux-gnu -fsanitize=hwaddress -fsanitize-blocklist=%t.good -fsanitize-blocklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BLOCKLIST +// CHECK-BLOCKLIST: -fsanitize-blocklist={{.*}}.good" "-fsanitize-blocklist={{.*}}.second -// Check that the default blacklist is not added as an extra dependency. -// 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-ASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blacklist= -// CHECK-DEFAULT-BLACKLIST-ASAN: -fsanitize-system-blacklist={{.*[^w]}}asan_blacklist.txt -// RUN: %clang -target x86_64-linux-gnu -fsanitize=hwaddress -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-BLACKLIST-HWASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blacklist= -// CHECK-DEFAULT-BLACKLIST-HWASAN: -fsanitize-system-blacklist={{.*}}hwasan_blacklist.txt +// Check that the default blocklist is not added as an extra dependency. +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-BLOCKLIST-ASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blocklist= +// CHECK-DEFAULT-BLOCKLIST-ASAN: -fsanitize-system-blocklist={{.*[^w]}}asan_blocklist.txt +// RUN: %clang -target x86_64-linux-gnu -fsanitize=hwaddress -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-BLOCKLIST-HWASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blocklist= +// CHECK-DEFAULT-BLOCKLIST-HWASAN: -fsanitize-system-blocklist={{.*}}hwasan_blocklist.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 --implicit-check-not=-fsanitize-blacklist= -// 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 --implicit-check-not=-fsanitize-blacklist= -// 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 --implicit-check-not=-fsanitize-blacklist= -// 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 --implicit-check-not=-fsanitize-blacklist= -// RUN: %clang -target %itanium_abi_triple -fsanitize=float-divide-by-zero -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLACKLIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blacklist= -// CHECK-DEFAULT-UBSAN-BLACKLIST: -fsanitize-system-blacklist={{.*}}ubsan_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-BLOCKLIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blocklist= +// 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-BLOCKLIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blocklist= +// 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-BLOCKLIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blocklist= +// 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-BLOCKLIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blocklist= +// RUN: %clang -target %itanium_abi_triple -fsanitize=float-divide-by-zero -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLOCKLIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blocklist= +// CHECK-DEFAULT-UBSAN-BLOCKLIST: -fsanitize-system-blocklist={{.*}}ubsan_blocklist.txt -// Check that combining ubsan and another sanitizer results in both blacklists being used. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined,address -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLACKLIST --check-prefix=CHECK-DEFAULT-BLACKLIST-ASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blacklist= +// Check that combining ubsan and another sanitizer results in both blocklists being used. +// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined,address -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-BLOCKLIST --check-prefix=CHECK-DEFAULT-BLOCKLIST-ASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-blocklist= -// 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 +// Ignore -fsanitize-blocklist flag if there is no -fsanitize flag. +// RUN: %clang -target x86_64-linux-gnu -fsanitize-blocklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE --check-prefix=DELIMITERS +// CHECK-NO-SANITIZE-NOT: -fsanitize-blocklist -// Ignore -fsanitize-blacklist flag if there is no -fsanitize flag. +// Ignore -fsanitize-blocklist flag if there is no -fsanitize flag. // Now, check for the absence of -fdepfile-entry flags. -// RUN: %clang -target x86_64-linux-gnu -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE2 --check-prefix=DELIMITERS +// RUN: %clang -target x86_64-linux-gnu -fsanitize-blocklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE2 --check-prefix=DELIMITERS // CHECK-NO-SANITIZE2-NOT: -fdepfile-entry -// Flag -fno-sanitize-blacklist wins if it is specified later. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blacklist=%t.good -fno-sanitize-blacklist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-BLACKLIST --check-prefix=DELIMITERS -// CHECK-NO-BLACKLIST-NOT: -fsanitize-blacklist +// Flag -fno-sanitize-blocklist wins if it is specified later. +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blocklist=%t.good -fno-sanitize-blocklist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-BLOCKLIST --check-prefix=DELIMITERS +// CHECK-NO-BLOCKLIST-NOT: -fsanitize-blocklist -// Driver barks on unexisting blacklist files. -// RUN: %clang -target x86_64-linux-gnu -fno-sanitize-blacklist -fsanitize-blacklist=unexisting.txt %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SUCH-FILE +// Driver barks on unexisting blocklist files. +// RUN: %clang -target x86_64-linux-gnu -fno-sanitize-blocklist -fsanitize-blocklist=unexisting.txt %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SUCH-FILE // CHECK-NO-SUCH-FILE: error: no such file or directory: 'unexisting.txt' -// Driver properly reports malformed blacklist files. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blacklist=%t.second -fsanitize-blacklist=%t.bad -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BAD-BLACKLIST -// CHECK-BAD-BLACKLIST: error: malformed sanitizer blacklist: 'error parsing file '{{.*}}.bad': malformed line 1: 'badline'' +// Driver properly reports malformed blocklist files. +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blocklist=%t.second -fsanitize-blocklist=%t.bad -fsanitize-blocklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BAD-BLOCKLIST +// CHECK-BAD-BLOCKLIST: error: malformed sanitizer blacklist: 'error parsing file '{{.*}}.bad': malformed line 1: 'badline'' -// -fno-sanitize-blacklist disables all blacklists specified earlier. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blacklist=%t.good -fno-sanitize-blacklist -fsanitize-blacklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-FIRST-DISABLED --implicit-check-not=-fsanitize-blacklist= +// -fno-sanitize-blocklist disables all blocklists specified earlier. +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blocklist=%t.good -fno-sanitize-blocklist -fsanitize-blocklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-FIRST-DISABLED --implicit-check-not=-fsanitize-blocklist= // CHECK-ONLY_FIRST-DISABLED-NOT: good -// CHECK-ONLY-FIRST-DISABLED: -fsanitize-blacklist={{.*}}.second +// CHECK-ONLY-FIRST-DISABLED: -fsanitize-blocklist={{.*}}.second // CHECK-ONLY_FIRST-DISABLED-NOT: good -// -fno-sanitize-blacklist disables the system blacklists. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fno-sanitize-blacklist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DISABLED-SYSTEM --check-prefix=DELIMITERS -// CHECK-DISABLED-SYSTEM-NOT: -fsanitize-system-blacklist +// -fno-sanitize-blocklist disables the system blocklists. +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fno-sanitize-blocklist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DISABLED-SYSTEM --check-prefix=DELIMITERS +// CHECK-DISABLED-SYSTEM-NOT: -fsanitize-system-blocklist -// If cfi_blacklist.txt cannot be found in the resource dir, driver should fail. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -flto -fvisibility=default -resource-dir=/dev/null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-CFI-BLACKLIST -// CHECK-MISSING-CFI-BLACKLIST: error: no such file or directory: '{{.*}}cfi_blacklist.txt' +// If cfi_blocklist.txt cannot be found in the resource dir, driver should fail. +// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -flto -fvisibility=default -resource-dir=/dev/null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-CFI-BLOCKLIST +// CHECK-MISSING-CFI-BLOCKLIST: error: no such file or directory: '{{.*}}cfi_blocklist.txt' -// -fno-sanitize-blacklist disables checking for cfi_blacklist.txt in the resource dir. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -flto -fvisibility=default -fno-sanitize-blacklist -resource-dir=/dev/null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-CFI-NO-BLACKLIST -// CHECK-MISSING-CFI-NO-BLACKLIST-NOT: error: no such file or directory: '{{.*}}cfi_blacklist.txt' +// -fno-sanitize-blocklist disables checking for cfi_blocklist.txt in the resource dir. +// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -flto -fvisibility=default -fno-sanitize-blocklist -resource-dir=/dev/null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-CFI-NO-BLOCKLIST +// CHECK-MISSING-CFI-NO-BLOCKLIST-NOT: error: no such file or directory: '{{.*}}cfi_blocklist.txt' // DELIMITERS: {{^ *"}} diff --git a/clang/test/Driver/print-file-name.c b/clang/test/Driver/print-file-name.c --- a/clang/test/Driver/print-file-name.c +++ b/clang/test/Driver/print-file-name.c @@ -1,10 +1,10 @@ // Test that -print-file-name finds the correct file. -// RUN: %clang -print-file-name=share/asan_blacklist.txt 2>&1 \ +// RUN: %clang -print-file-name=share/asan_blocklist.txt 2>&1 \ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --target=x86_64-linux-gnu \ // RUN: | FileCheck --check-prefix=CHECK-RESOURCE-DIR %s -// CHECK-RESOURCE-DIR: resource_dir{{/|\\}}share{{/|\\}}asan_blacklist.txt +// CHECK-RESOURCE-DIR: resource_dir{{/|\\}}share{{/|\\}}asan_blocklist.txt // RUN: %clang -print-file-name=libclang_rt.builtins.a 2>&1 \ // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \ diff --git a/clang/test/Frontend/Inputs/resource_dir_with_sanitizer_blacklist/share/ubsan_blacklist.txt b/clang/test/Frontend/Inputs/resource_dir_with_sanitizer_blacklist/share/ubsan_blocklist.txt rename from clang/test/Frontend/Inputs/resource_dir_with_sanitizer_blacklist/share/ubsan_blacklist.txt rename to clang/test/Frontend/Inputs/resource_dir_with_sanitizer_blacklist/share/ubsan_blocklist.txt diff --git a/clang/test/Frontend/dependency-gen.c b/clang/test/Frontend/dependency-gen.c --- a/clang/test/Frontend/dependency-gen.c +++ b/clang/test/Frontend/dependency-gen.c @@ -20,27 +20,27 @@ // RUN: cd a/b // RUN: %clang -MD -MF - %s -fsyntax-only -I ./ | FileCheck -check-prefix=CHECK-SIX %s // CHECK-SIX: {{ }}x.h -// RUN: echo "fun:foo" > %t.blacklist -// RUN: %clang -MD -MF - %s -fsyntax-only -resource-dir=%S/Inputs/resource_dir_with_sanitizer_blacklist -fsanitize=undefined -flto -fvisibility=hidden -fsanitize-blacklist=%t.blacklist -I ./ | FileCheck -check-prefix=CHECK-SEVEN %s -// CHECK-SEVEN: .blacklist +// RUN: echo "fun:foo" > %t.blocklist +// RUN: %clang -MD -MF - %s -fsyntax-only -resource-dir=%S/Inputs/resource_dir_with_sanitizer_blacklist -fsanitize=undefined -flto -fvisibility=hidden -fsanitize-blocklist=%t.blocklist -I ./ | FileCheck -check-prefix=CHECK-SEVEN %s +// CHECK-SEVEN: .blocklist // CHECK-SEVEN: {{ }}x.h #ifndef INCLUDE_FLAG_TEST #include #endif -// RUN: echo "fun:foo" > %t.blacklist1 -// RUN: echo "fun:foo" > %t.blacklist2 -// RUN: %clang -MD -MF - %s -fsyntax-only -resource-dir=%S/Inputs/resource_dir_with_sanitizer_blacklist -fsanitize=undefined -flto -fvisibility=hidden -fsanitize-blacklist=%t.blacklist1 -fsanitize-blacklist=%t.blacklist2 -I ./ | FileCheck -check-prefix=TWO-BLACK-LISTS %s -// TWO-BLACK-LISTS: dependency-gen.o: -// TWO-BLACK-LISTS-DAG: blacklist1 -// TWO-BLACK-LISTS-DAG: blacklist2 -// TWO-BLACK-LISTS-DAG: x.h -// TWO-BLACK-LISTS-DAG: dependency-gen.c +// RUN: echo "fun:foo" > %t.blocklist1 +// RUN: echo "fun:foo" > %t.blocklist2 +// RUN: %clang -MD -MF - %s -fsyntax-only -resource-dir=%S/Inputs/resource_dir_with_sanitizer_blacklist -fsanitize=undefined -flto -fvisibility=hidden -fsanitize-blocklist=%t.blocklist1 -fsanitize-blocklist=%t.blocklist2 -I ./ | FileCheck -check-prefix=TWO-BLOCK-LISTS %s +// TWO-BLOCK-LISTS: dependency-gen.o: +// TWO-BLOCK-LISTS-DAG: blocklist1 +// TWO-BLOCK-LISTS-DAG: blocklist2 +// TWO-BLOCK-LISTS-DAG: x.h +// TWO-BLOCK-LISTS-DAG: dependency-gen.c // RUN: %clang -MD -MF - %s -fsyntax-only -resource-dir=%S/Inputs/resource_dir_with_sanitizer_blacklist -fsanitize=undefined -flto -fvisibility=hidden -I ./ | FileCheck -check-prefix=USER-AND-SYS-DEPS %s // USER-AND-SYS-DEPS: dependency-gen.o: -// USER-AND-SYS-DEPS-DAG: ubsan_blacklist.txt +// USER-AND-SYS-DEPS-DAG: ubsan_blocklist.txt // RUN: %clang -MMD -MF - %s -fsyntax-only -resource-dir=%S/Inputs/resource_dir_with_sanitizer_blacklist -fsanitize=undefined -flto -fvisibility=hidden -I ./ | FileCheck -check-prefix=ONLY-USER-DEPS %s // ONLY-USER-DEPS: dependency-gen.o: -// NOT-ONLY-USER-DEPS: ubsan_blacklist.txt +// NOT-ONLY-USER-DEPS: ubsan_blocklist.txt diff --git a/clang/unittests/Driver/SanitizerArgsTest.cpp b/clang/unittests/Driver/SanitizerArgsTest.cpp --- a/clang/unittests/Driver/SanitizerArgsTest.cpp +++ b/clang/unittests/Driver/SanitizerArgsTest.cpp @@ -92,30 +92,30 @@ std::unique_ptr CompilationJob; }; -TEST_F(SanitizerArgsTest, Blacklists) { +TEST_F(SanitizerArgsTest, Blocklists) { const std::string ResourceDir = "/opt/llvm/lib/resources"; - const std::string UserBlacklist = "/source/my_blacklist.txt"; - const std::string ASanBlacklist = - concatPaths({ResourceDir, "share", "asan_blacklist.txt"}); + const std::string UserBlocklist = "/source/my_blocklist.txt"; + const std::string ASanBlocklist = + concatPaths({ResourceDir, "share", "asan_blocklist.txt"}); auto &Command = emulateSingleCompilation( /*ExtraArgs=*/{"-fsanitize=address", "-resource-dir", ResourceDir, - std::string("-fsanitize-blacklist=") + UserBlacklist}, - /*ExtraFiles=*/{ASanBlacklist, UserBlacklist}); + std::string("-fsanitize-blocklist=") + UserBlocklist}, + /*ExtraFiles=*/{ASanBlocklist, UserBlocklist}); - // System blacklists are added based on resource-dir. + // System blocklists are added based on resource-dir. EXPECT_THAT(Command.getArguments(), - Contains(StrEq(std::string("-fsanitize-system-blacklist=") + - ASanBlacklist))); - // User blacklists should also be added. + Contains(StrEq(std::string("-fsanitize-system-blocklist=") + + ASanBlocklist))); + // User blocklists should also be added. EXPECT_THAT( Command.getArguments(), - Contains(StrEq(std::string("-fsanitize-blacklist=") + UserBlacklist))); + Contains(StrEq(std::string("-fsanitize-blocklist=") + UserBlocklist))); } TEST_F(SanitizerArgsTest, XRayLists) { const std::string XRayWhitelist = "/source/xray_whitelist.txt"; - const std::string XRayBlacklist = "/source/xray_blacklist.txt"; + const std::string XRayBlocklist = "/source/xray_blocklist.txt"; const std::string XRayAttrList = "/source/xray_attr_list.txt"; auto &Command = emulateSingleCompilation( @@ -123,17 +123,17 @@ { "-fxray-instrument", "-fxray-always-instrument=" + XRayWhitelist, - "-fxray-never-instrument=" + XRayBlacklist, + "-fxray-never-instrument=" + XRayBlocklist, "-fxray-attr-list=" + XRayAttrList, }, - /*ExtraFiles=*/{XRayWhitelist, XRayBlacklist, XRayAttrList}); + /*ExtraFiles=*/{XRayWhitelist, XRayBlocklist, XRayAttrList}); - // Blacklists exist in the filesystem, so they should be added to the + // Blocklists exist in the filesystem, so they should be added to the // compilation command, produced by the driver. EXPECT_THAT(Command.getArguments(), Contains(StrEq("-fxray-always-instrument=" + XRayWhitelist))); EXPECT_THAT(Command.getArguments(), - Contains(StrEq("-fxray-never-instrument=" + XRayBlacklist))); + Contains(StrEq("-fxray-never-instrument=" + XRayBlocklist))); EXPECT_THAT(Command.getArguments(), Contains(StrEq("-fxray-attr-list=" + XRayAttrList))); }