- Enable extra coverage counters on Windows.
- Update extra_counters.test to run on Windows also.
- Update TableLookupTest.cpp to include the required pragma/declspec for the extra coverage counters.
Details
- Reviewers
kcc rnk morehouse - Commits
- rG881faf41909b: Enable extra coverage counters on Windows
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Seems reasonable to me, I have no familiarity with the extra counters feature, though. You might consider using explicit alignments.
Something else to consider is that the MSVC incremental linker adds padding between variables to allow resizing them between links. I think these days we just don't care about that anymore. In the past, we did work to make sure asan would work under those conditions.
compiler-rt/lib/fuzzer/FuzzerExtraCounters.cpp | ||
---|---|---|
46–48 | Maybe __libfuzzer_extra_counter_a / __libfuzzer_extra_counter_z would make that clearer. "r, s, t" seems like a surprising part of the alphabet to use when establishing an ordering with lexicographic sorting. | |
89 | Standard optimizations like loop idiom recognition will undo this. Is this enough to prevent ASan instrumentation? I'd suggest making these pointers volatile to be really confident that this won't become instrumented in the future. |
Updates based on code review.
- Added explicit alignment to start and stop sections.
- Updated comments to better explain the alignment/padding requirements of the sections.
- Update the section names to be more intuitive with regards to sorting.
- Updated manual memset to use SecureZeroMemory to ensure it doesn't get optimized out.
Ping.
I made updates based on recommendations from @rnk.
I'm also realizing I likely don't have commit access and would appreciate if someone could commit on my behalf (assuming review approval).
Thanks!
Marking previous comments as done. I didn't realize this was something I could do - sorry, first time using this code review system.
One comment that I have is a request to limit the number of #ifdefs in the code to at most one.
We typically achieve this by having platform-specific code in a platform-specific file, guarded with an ifdef.
an extra ifdef in a test is probably unavoidable.
compiler-rt/test/fuzzer/extra-counters.test | ||
---|---|---|
1 | does this imply that the test will now work on Mac? |
compiler-rt/test/fuzzer/extra-counters.test | ||
---|---|---|
1 | No. Good catch, thanks! I updated the test to be unsupported on darwin. |
compiler-rt/lib/fuzzer/FuzzerExtraCountersWindows.cpp | ||
---|---|---|
15 ↗ | (On Diff #364563) | This broke cross building from case sensitive filesystems with mingw; I pushed a fix for it in ab737d5367cdea30df71ef66f87fe2c6d88e7246. |
Maybe __libfuzzer_extra_counter_a / __libfuzzer_extra_counter_z would make that clearer. "r, s, t" seems like a surprising part of the alphabet to use when establishing an ordering with lexicographic sorting.