[llvm] r286615 - [sancov] Don't instrument MSVC CRT stdio config helpers

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 11 11:18:45 PST 2016


Author: rnk
Date: Fri Nov 11 13:18:45 2016
New Revision: 286615

URL: http://llvm.org/viewvc/llvm-project?rev=286615&view=rev
Log:
[sancov] Don't instrument MSVC CRT stdio config helpers

They get called before initialization, which is a problem for winasan.

Test coming in compiler-rt.

Modified:
    llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp

Modified: llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp?rev=286615&r1=286614&r2=286615&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp Fri Nov 11 13:18:45 2016
@@ -448,6 +448,11 @@ bool SanitizerCoverageModule::runOnFunct
     return false; // Should not instrument sanitizer init functions.
   if (F.getName().startswith("__sanitizer_"))
     return false;  // Don't instrument __sanitizer_* callbacks.
+  // Don't instrument MSVC CRT configuration helpers. They may run before normal
+  // initialization.
+  if (F.getName() == "__local_stdio_printf_options" ||
+      F.getName() == "__local_stdio_scanf_options")
+    return false;
   // Don't instrument functions using SEH for now. Splitting basic blocks like
   // we do for coverage breaks WinEHPrepare.
   // FIXME: Remove this when SEH no longer uses landingpad pattern matching.




More information about the llvm-commits mailing list