[clang] [ASAN] Adjust asan instrumented GlobalVariable size to not include redzone (PR #66666)

via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 21 07:45:11 PDT 2023


================
@@ -2445,6 +2445,11 @@ bool ModuleAddressSanitizer::InstrumentGlobals(IRBuilder<> &IRB, Module &M,
     // zero so we can copy the metadata over as is.
     NewGlobal->copyMetadata(G, 0);
 
+    // Set sanitizer metadata for newly created global,
+    // if it doesn't have it.
----------------
skc7 wrote:

Clang codegen seems to add the SanitizerMetadata for globals, but when asan pass is run, some globals seems to have lost that. So I'm checking in asan pass if globals hasSanitizerMetadata() and if not present, adding one, with NoAddress set to false.
This is used in AsmPrinter, to identify the asan instrumented globals with padded redzones.

https://github.com/llvm/llvm-project/pull/66666


More information about the cfe-commits mailing list