[PATCH] Make sure globals created by UBSan are not instrumented by ASan.

Alexey Samsonov vonosmas at gmail.com
Thu Jul 17 17:55:53 PDT 2014


================
Comment at: lib/CodeGen/CGExpr.cpp:2179-2180
@@ +2178,4 @@
+  if (PLoc.isValid()) {
+    auto FilenameGV = CGM.GetAddrOfConstantCString(PLoc.getFilename(), ".src");
+    CGM.disableSanitizerForGlobal(FilenameGV);
+    Filename = FilenameGV;
----------------
Richard Smith wrote:
> I'm concerned about this one: these strings may be shared by other parts of the program, where ASan instrumentation is important. How much does instrumenting these strings cost us?
Yeah, we might get false negatives on out-of-bound access to stuff like __FILE__. I don't think it's a big deal, though. We already create several global strings in ASan instrumentation (including the string with filename for the global, name for the global etc.) and call setUnnamedAddr(true), allowing to merge them.

http://reviews.llvm.org/D4575






More information about the cfe-commits mailing list