This is an archive of the discontinued LLVM Phabricator instance.

[msan] Check mask and pointers shadow
ClosedPublic

Authored by vitalybuka on Sep 11 2022, 1:19 PM.

Details

Summary

Msan has default handler for unknown instructions which
previously applied to these as well. However depending on
mask, not all pointers or passthru part will be used. This
allows other passes to insert undef into sum arguments.
As result, default strict instruction handler can produce false reports.

Diff Detail

Event Timeline

vitalybuka created this revision.Sep 11 2022, 1:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 11 2022, 1:19 PM
vitalybuka requested review of this revision.Sep 11 2022, 1:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 11 2022, 1:19 PM
vitalybuka edited the summary of this revision. (Show Details)Sep 12 2022, 10:18 AM
vitalybuka edited the summary of this revision. (Show Details)Sep 12 2022, 10:20 AM
vitalybuka edited the summary of this revision. (Show Details)
kda added inline comments.Sep 14 2022, 1:58 PM
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
3270

"Store shadow"?

3276–3277

What is this for?
It does not seem to be used.

3298

not 2?

3309

"Check Loaded shadow"?

llvm/test/Instrumentation/MemorySanitizer/masked-store-load.ll
359–370

I thought this would have been swept into the implementation (as it was elsewhere).
What am I missing?

kda added inline comments.Sep 14 2022, 5:45 PM
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
3276–3277

Maybe move to https://reviews.llvm.org/D133682, as you did for handleMaskedScatter.

3298

I see you using it in https://reviews.llvm.org/D133682.

vitalybuka marked 6 inline comments as done.

comments

llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
3309

Actually Scatter it kind of store, so we need to store the shadown

llvm/test/Instrumentation/MemorySanitizer/masked-store-load.ll
359–370

This is from introduced

if (ClCheckAccessAddress) {
  insertShadowCheck(Ptr, &I);
  insertShadowCheck(Mask, &I);
}
kstoimenov accepted this revision.Sep 19 2022, 10:36 AM
This revision is now accepted and ready to land.Sep 19 2022, 10:36 AM
kda accepted this revision.Sep 19 2022, 12:01 PM
This revision was landed with ongoing or failed builds.Sep 19 2022, 1:10 PM
This revision was automatically updated to reflect the committed changes.