[PATCH] D37925: Allow specifying sanitizers in blacklists

Evgenii Stepanov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 20 18:05:03 PDT 2017


eugenis added a subscriber: dberris.
eugenis added inline comments.


================
Comment at: include/clang/Basic/SanitizerSpecialCaseList.h:39
+  // Initialize SanitizerSections.
+  void sanitizerCompile();
+
----------------
"compile" in this method name is confusing. It's used in the base class to refer to regexp compilation. Let's call this one createSanitizerSections.



================
Comment at: lib/AST/Decl.cpp:3932
   ASTContext &Context = getASTContext();
-  if (!Context.getLangOpts().Sanitize.hasOneOf(
-          SanitizerKind::Address | SanitizerKind::KernelAddress) ||
+  const SanitizerMask ASanMask =
+      SanitizerKind::Address | SanitizerKind::KernelAddress;
----------------
"Asan" is a more common spelling in clang & compiler-rt identifiers (even though official abbreviation is ASan).


================
Comment at: lib/AST/Decl.cpp:3953
     ReasonToReject = 5;  // is standard layout.
-  else if (Blacklist.isBlacklistedLocation(getLocation(), "field-padding"))
+  else if (Blacklist.isBlacklistedLocation(ASanMask, getLocation(),
+                                           "field-padding"))
----------------
Looks like this is another case of missing "& LangOpts.Sanitize.Mask" ?


================
Comment at: lib/Basic/XRayLists.cpp:29
   // whether it's treated as a "never" instrument function.
-  if (AlwaysInstrument->inSection("fun", FunctionName, "arg1"))
+  if (AlwaysInstrument->inSection("xray_always_instrument", "fun", FunctionName,
+                                  "arg1"))
----------------
It feels redundant to have AlwaysInstrument and NeverInstrument lists, and then the same distinction in section names. Maybe sections could be named "xray" in  both cases? Or, better, the lists could be merged into a single list with always and never sections? There is also an issue of backward compatibility. Anyway, that's for xray devs to decide. @dberris 


================
Comment at: lib/CodeGen/CodeGenModule.cpp:1564
   // For now globals can be blacklisted only in ASan and KASan.
-  if (!LangOpts.Sanitize.hasOneOf(
-          SanitizerKind::Address | SanitizerKind::KernelAddress))
+  const SanitizerMask ASanMask =
+      SanitizerKind::Address | SanitizerKind::KernelAddress;
----------------
AsanMask


https://reviews.llvm.org/D37925





More information about the cfe-commits mailing list