[PATCH] D28436: [Sanitizer Coverage] Modify initialization of array bounds for sanitizer coverage.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 15:09:49 PST 2017


mpividori added a comment.

@rnk , yes. I was worrying about that too, the size of the data in the binary files.....
The problem is that we need to distinguish between the parts of the section that belongs to a guard array and the parts of the sections that represents zero padding.
If we consider the zero padding as part of the arrays, we won't have an accurate information about the coverage, because that "guards" will never be visited.

I see 2 possible solutions if we want to keep that data in .bss:

+ Require non-incremental linking for instrumented code (and assume this doesn't include padding).

+ Modify the instrumentation. Instead of inserting `__sanitizer_cov_trace_pc_guard_init(__start___sancov_guards,__stop___sancov_guards)` for each TU, we could insert:  `__sanitizer_cov_trace_pc_guard_init(pointer to beginning of array of guards in that TU, pointer to end of array of guard in that TU)`. This would require some changes in the Module Pass for Sanitizer Coverage, since we should create an array for all the TU, so we need to know the number of basic block in that TU (currently we create an array when instrumenting each function, with the length of the number of basic blocks in that function). This shouldn't be very difficult to implement.


Repository:
  rL LLVM

https://reviews.llvm.org/D28436





More information about the llvm-commits mailing list