This is an archive of the discontinued LLVM Phabricator instance.

[dfsan] Expose dfsan_get_track_origins to get origin tracking status
ClosedPublic

Authored by stephan.yichao.zhao on Jun 29 2021, 8:35 AM.

Details

Summary

This allows application code checks if origin tracking is on before
printing out traces.

-dfsan-track-origins can be 0,1,2.
The current code only distinguishes 1 and 2 in compile time, but not at runtime.
Made runtime distinguish 1 and 2 too.

Diff Detail

Event Timeline

stephan.yichao.zhao requested review of this revision.Jun 29 2021, 8:35 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 29 2021, 8:35 AM
Herald added subscribers: llvm-commits, Restricted Project. · View Herald Transcript

added a missing file

browneee added inline comments.Jun 29 2021, 12:37 PM
compiler-rt/include/sanitizer/dfsan_interface.h
145

Comment here should explain the meaning of different return values, or link to something that does.

compiler-rt/lib/dfsan/dfsan.cpp
55

We're missing documentation for these options (e.g. https://clang.llvm.org/docs/MemorySanitizer.html#origin-tracking )

stephan.yichao.zhao marked an inline comment as done.

Added more comments to dfsan_get_track_origins.

compiler-rt/lib/dfsan/dfsan.cpp
55

The doc diff for origin tracking has never been submitted. I will add one soon.

browneee accepted this revision.Jun 29 2021, 1:29 PM
This revision is now accepted and ready to land.Jun 29 2021, 1:29 PM