[llvm] r286665 - [libFuzzer] do not initialize parts of TracePC -- let them be initialized by the linker. Add no-msan attribute to the memcmp hook.

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 11 15:06:53 PST 2016


Author: kcc
Date: Fri Nov 11 17:06:53 2016
New Revision: 286665

URL: http://llvm.org/viewvc/llvm-project?rev=286665&view=rev
Log:
[libFuzzer] do not initialize parts of TracePC -- let them be initialized by the linker. Add no-msan attribute to the memcmp hook.

Modified:
    llvm/trunk/lib/Fuzzer/FuzzerTracePC.cpp
    llvm/trunk/lib/Fuzzer/FuzzerTracePC.h

Modified: llvm/trunk/lib/Fuzzer/FuzzerTracePC.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerTracePC.cpp?rev=286665&r1=286664&r2=286665&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerTracePC.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerTracePC.cpp Fri Nov 11 17:06:53 2016
@@ -218,6 +218,9 @@ void TracePC::PrintCoverage() {
 // For cmp instructions the interesting value is a XOR of the parameters.
 // The interesting value is mixed up with the PC and is then added to the map.
 
+#ifdef __clang__  // avoid gcc warning.
+__attribute__((no_sanitize("memory")))
+#endif
 void TracePC::AddValueForMemcmp(void *caller_pc, const void *s1, const void *s2,
                               size_t n) {
   if (!n) return;

Modified: llvm/trunk/lib/Fuzzer/FuzzerTracePC.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerTracePC.h?rev=286665&r1=286664&r2=286665&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerTracePC.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerTracePC.h Fri Nov 11 17:06:53 2016
@@ -101,8 +101,8 @@ private:
   };
 
   Module Modules[4096];
-  size_t NumModules = 0;
-  size_t NumGuards = 0;
+  size_t NumModules;  // linker-initialized.
+  size_t NumGuards;  // linker-initialized.
 
   static const size_t kNumCounters = 1 << 14;
   alignas(8) uint8_t Counters[kNumCounters];




More information about the llvm-commits mailing list