[PATCH] D112732: [ASan] Process functions in Asan module pass

Vitaly Buka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 2 19:15:51 PDT 2021


vitalybuka accepted this revision.
vitalybuka added a comment.
This revision is now accepted and ready to land.

Lets keep AddressSanitizerPass for a while, we don't have to remove it in the same patch



================
Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:1289
+  }
+  Modified |= ModuleSanitizer.instrumentModule(M);
+  if (Modified)
----------------
kstoimenov wrote:
> At first I had module sanitizer run first, but some tests failed. Is it possible that the function pass has some side effects, which are used by the module pass? 
That's OK.

NewPMDriver.cpp was wrong, BackendUtil.cpp was wrong

if we put module in-front of function  the following with disable globals instrumentation:
```
 if (G && (!ClInitializers || GlobalIsLinkerInitialized(G)) &&
        isSafeAccess(ObjSizeVis, Addr, O.TypeSize)) {
```



================
Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:2829
   if (F.getName().startswith("__asan_")) return false;
+  if (F.empty()) return false;
 
----------------
kstoimenov wrote:
> This was a pain to figure out. Maybe we should apply the same check in HWAsan? 
I looks like should be the first "if" in the function


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112732



More information about the cfe-commits mailing list