This is an archive of the discontinued LLVM Phabricator instance.

tsan: properly instrument unaligned accesses
ClosedPublic

Authored by dvyukov on Jan 19 2015, 6:09 AM.

Details

Reviewers
kcc
samsonov
Summary

If a memory access is unaligned, emit tsan_unaligned_read/write callbacks instead of tsan_read/write.
Required to change semantics of tsan_unaligned_read/write to not do the user memory. But since they were unused (other than through sanitizer_unaligned_load/store) this is fine.
Fixes long standing issue 17:
https://code.google.com/p/thread-sanitizer/issues/detail?id=17

Diff Detail

Event Timeline

dvyukov updated this revision to Diff 18389.Jan 19 2015, 6:09 AM
dvyukov retitled this revision from to tsan: properly instrument unaligned accesses.
dvyukov updated this object.
dvyukov edited the test plan for this revision. (Show Details)
dvyukov added reviewers: kcc, samsonov.
dvyukov added a subscriber: Unknown Object (MLST).
kcc added inline comments.Jan 21 2015, 7:02 PM
test/Instrumentation/ThreadSanitizer/unaligned.ll
12

CHECK-LABEL, here and below

test/tsan/aligned_vs_unaligned_race.cc
16

you probably want to update the test here (remove sleep)

dvyukov updated this revision to Diff 18838.Jan 27 2015, 11:59 AM

All done
PTAL

kcc accepted this revision.Jan 27 2015, 12:12 PM
kcc edited edge metadata.

LGTM with one nit

test/tsan/aligned_vs_unaligned_race.cc
1

do you still need deflake here?

This revision is now accepted and ready to land.Jan 27 2015, 12:12 PM
dvyukov added inline comments.Jan 27 2015, 12:17 PM
test/tsan/aligned_vs_unaligned_race.cc
1

Currently all positive tests use it.
We need a larger cleanup later. But let it be consistent for now.

16

Done

Committed as rev 227230 and 227231.