This is an archive of the discontinued LLVM Phabricator instance.

[sancov] Implement __sanitizer_cov_reset.
ClosedPublic

Authored by eugenis on Jul 27 2017, 3:50 PM.

Event Timeline

eugenis created this revision.Jul 27 2017, 3:50 PM
kcc added inline comments.Jul 27 2017, 3:57 PM
compiler-rt/include/sanitizer/coverage_interface.h
25–29

Write something about threads (more that one thread => warranty void)

compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc
128

This way you never modify the guard after the initial init, so why not just use a plain load?

eugenis updated this revision to Diff 108539.Jul 27 2017, 4:12 PM

PTAL. I've slapped a mutex on all updates to pc_vector other than new coverage. This should prevent reset/dump vs dlopen conflicts (dlopen may reallocate pc_vector). Reset/dump vs new coverage is IMHO too trivial to even mention in the comments, and completely safe.

eugenis updated this revision to Diff 108543.Jul 27 2017, 4:17 PM

Removed the lock. Was not a good idea: we can not protect new coverage vs dlopen anyway (which is the most common race by far).

kcc accepted this revision.Jul 27 2017, 4:19 PM

LGTM

This revision is now accepted and ready to land.Jul 27 2017, 4:19 PM
This revision was automatically updated to reflect the committed changes.