This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer coverage] add a basic default implementation of callbacks for -fsanitize-coverage=inline-8bit-counters,pc-table
ClosedPublic

Authored by kcc on Aug 19 2021, 1:52 PM.

Details

Summary

[sanitizer coverage] add a basic default implementation of callbacks for -fsanitize-coverage=inline-8bit-counters,pc-table

Diff Detail

Event Timeline

kcc requested review of this revision.Aug 19 2021, 1:52 PM
kcc created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptAug 19 2021, 1:52 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
kcc updated this revision to Diff 367631.Aug 19 2021, 3:18 PM

fix dfsan build

kcc updated this revision to Diff 367800.Aug 20 2021, 9:07 AM

fix a test

kcc updated this revision to Diff 367819.Aug 20 2021, 9:56 AM

one more test fix (can't expect xxd to be present)

kostik accepted this revision.Aug 23 2021, 3:44 PM
kostik added inline comments.
compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp
172

do you need to check that fd!=-1 here (not sure about the llvm convention). Similarly below

compiler-rt/lib/sanitizer_common/sanitizer_flags.inc
163

are these flags generally documented somewhere? If so, consider updating documentation as well.
I only found https://github.com/google/sanitizers/wiki/AddressSanitizerFlags which does not look like the canonical location.

This revision is now accepted and ready to land.Aug 23 2021, 3:44 PM
kcc added inline comments.Aug 24 2021, 2:44 PM
compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp
172

Of OpenFile fails, it will write something like

==42028==SanitizerCoverage: failed to open /zz for writing (reason: 13)

and nothing else will break, so a check would be redundant.

compiler-rt/lib/sanitizer_common/sanitizer_flags.inc
163

These are documented in https://clang.llvm.org/docs/SanitizerCoverage.html but for the time being I am hesitant to document it there.
I want to first see how it's getting used by early adopters (like ourselves), if at all.

This revision was landed with ongoing or failed builds.Aug 24 2021, 2:56 PM
This revision was automatically updated to reflect the committed changes.