This is an archive of the discontinued LLVM Phabricator instance.

tsan: add kBrokenAliasedMetas condition and test
ClosedPublic

Authored by thurston on Jan 10 2023, 4:42 PM.

Details

Summary

This fills in a gap in the tsan_shadow_test coverage:
it is possible that the meta regions are aliased
(e.g., the heap meta region overlaps the high app meta
region). Indeed, the Aarch64_39 mapping has been
silently broken in this way for quite some time.

This CL checks whether the individual meta regions
(for low/mid/high/heap) overlap. Note that
(!kBrokenAliasedMetas && !kBrokenLinearity) implies
that MemToMeta is invertible; we cannot directly
test MetaToMem because that function does not exist.

Diff Detail

Event Timeline

thurston created this revision.Jan 10 2023, 4:42 PM
thurston requested review of this revision.Jan 10 2023, 4:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 10 2023, 4:42 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
vitalybuka accepted this revision.Jan 10 2023, 7:28 PM
vitalybuka added inline comments.
compiler-rt/lib/tsan/rtl/tsan_platform.h
170

I don't see these constants uses anywhere other than tests?

compiler-rt/lib/tsan/tests/unit/tsan_shadow_test.cpp
18
134

this code still uses Google style
region_a
num_regions
etc.

211
237–245
This revision is now accepted and ready to land.Jan 10 2023, 7:28 PM
thurston added inline comments.Jan 10 2023, 7:39 PM
compiler-rt/lib/tsan/rtl/tsan_platform.h
170

Yes, they are just annotations for documenting known issues with the mappings, to prevent tsan_shadow_test from failing.

Ideally the mappings would be corrected, such that they do not need any kBroken annotations. (I plan to fix the Aarch64_39 mapping in a follow-up CL.)

dvyukov accepted this revision.Jan 11 2023, 2:33 AM
thurston updated this revision to Diff 488253.Jan 11 2023, 9:11 AM

Fix style per Vitaly's comments

thurston marked 3 inline comments as done.Jan 11 2023, 9:11 AM
thurston updated this revision to Diff 488274.Jan 11 2023, 10:14 AM

Change printf format string to avoid typecast warning

This revision was landed with ongoing or failed builds.Jan 11 2023, 10:24 AM
This revision was automatically updated to reflect the committed changes.