[PATCH] D126929: Add sanitizer metadata attributes to clang IR gen.

Vitaly Buka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 7 14:27:17 PDT 2022


vitalybuka added a comment.

I simplified this a little bit, but I guess this is effectively the same.



================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:2767-2781
+  if (NoSanitizeL.containsGlobal(LangOpts.Sanitize.Mask, GV->getName(), Category))
     return true;
-  if (NoSanitizeL.containsLocation(EnabledAsanMask, Loc, Category))
+  if (NoSanitizeL.containsLocation(LangOpts.Sanitize.Mask, Loc, Category))
     return true;
   // Check global type.
   if (!Ty.isNull()) {
     // Drill down the array types: if global variable of a fixed type is
----------------
can this lines be landed separately?


================
Comment at: clang/lib/CodeGen/SanitizerMetadata.cpp:44
 
+  if (CGM.isInNoSanitizeList(GV, Loc, Ty))
+    Meta.NoSanitize = true;
----------------
it's incorrect as is
isInNoSanitizeList is sanitizer specific
we need to add isInNoSanitizeList version which return relevant SanitizerMask


================
Comment at: clang/lib/CodeGen/SanitizerMetadata.cpp:69
+                                          SanitizerKind::KernelAddress)) {
+    Meta.IsDynInit = IsDynInit && !CGM.isInNoSanitizeList(GV, Loc, Ty, "init");
+  }
----------------
Why don't we care about IsExcluded here?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126929/new/

https://reviews.llvm.org/D126929



More information about the cfe-commits mailing list