[PATCH] D51017: Enable -fsanitize=fuzzer and -fsanitize=fuzzer-no-link on Windows.

Jonathan Metzman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 20 17:37:47 PDT 2018


metzman added a reviewer: morehouse.
metzman added a comment.

Matt, could you please take a look at this?

This patch puts each array used by sancov/libFuzzer into a unique section. 
The section names all begin with `".SCOV"`, the next letter in the name signifies what the section is used for (eg: in `SCOVC$M`, `C` stands for Counters). 
The section names all end in `$M` so that libFuzzer will know the size and location of the arrays (this is how symbols such as `__start___sancov_cntrs` are set by the linker when targeting MSVC. This technique was first used for libFuzzer here <https://reviews.llvm.org/D28434>)
This change needs my patch for compiler-rt (specifically this file <https://github.com/llvm-mirror/compiler-rt/blob/master/lib/sanitizer_common/sanitizer_coverage_win_sections.cc#L16>) to make sense.



================
Comment at: lib/Transforms/Instrumentation/SanitizerCoverage.cpp:813
+    else if (Section == SanCovPCsSectionName)
+      return ".SCOVP$M";
+    return ".SCOVG$M";  // For SanCovGuardsSectionName.
----------------
This naming scheme isn't great, but we need 3 unique names that are less than or equal to 8 chars (this the maximum section name length, see https://msdn.microsoft.com/en-us/library/7977wcck.aspx).


================
Comment at: lib/Transforms/Instrumentation/SanitizerCoverage.cpp:814
+      return ".SCOVP$M";
+    return ".SCOVG$M";  // For SanCovGuardsSectionName.
+  }
----------------
Maybe I shouldn't rename the section used to store the guard array, since I am planning on leaving it in a broken state as per (what I think are) kcc's wishes, but I want to be consistent with the other section names.
What do you think?


Repository:
  rL LLVM

https://reviews.llvm.org/D51017





More information about the llvm-commits mailing list