[PATCH] D55857: [asan] Prevent folding of globals with redzones

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 18 16:46:29 PST 2018


pcc added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:2151
+    // Don't fold globals with redzones. This will cause false ODR-violation and
+    // global-buffer-overflow reports.
+    NewGlobal->setUnnamedAddr(GlobalValue::UnnamedAddr::None);
----------------
The comment should say that asan's ODR violation detector and redzone poisoning implicitly creates a dependence on the global's address, so it is no longer valid for it to be marked unnamed_addr.


================
Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:2203
     if (NewGlobal->hasLocalLinkage() || NewGlobal->hasLinkOnceODRLinkage() ||
         NewGlobal->hasWeakODRLinkage()) {
       ODRIndicator = ConstantExpr::getIntToPtr(ConstantInt::get(IntptrTy, -1),
----------------
Can we remove the linkonce_odr and weak_odr checks from here now?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D55857





More information about the llvm-commits mailing list