There could be some mis-alignments when copying origins not aligned. I believe unaligned memcpy is rare so the cases do not matter too much in practice. 1) About the change at line 50 Let dst be (void*)5, then d=5, beg=4 so we need to write 3 (4+4-5) bytes from 5 to 7. 2) About the change around line 77. Let dst be (void*)5, because of lines 50-55, the bytes from 5-7 were already writen. So the aligned copy is from 8.
Details
Details
- Reviewers
eugenis - Commits
- rG82655c151450: [MSan] Tweak CopyOrigin
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Hmm this code is a lot more approximate than I remember. The case where src % 4 != dst % 4 is quite broken, but you are right that it is not very common, and also ambiguous - when two poisoned 4-byte chunks with different origins contribute to the same 4-byte chunk in the output, the result can not be represented.
Your change makes it better, so LGTM but please check formatting.
compiler-rt/lib/msan/msan_poisoning.cpp | ||
---|---|---|
94 | did this go through clang-format? formatting looks strange. |
compiler-rt/lib/msan/msan_poisoning.cpp | ||
---|---|---|
94 | tried again. The formatter made the code like this for some reason... |
compiler-rt/lib/msan/msan_poisoning.cpp | ||
---|---|---|
94 | You are right, the same happens for me. OK then. clang-format is always right. |
did this go through clang-format? formatting looks strange.