This is an archive of the discontinued LLVM Phabricator instance.

[msan] Don't use TLS slots of noundef args
ClosedPublic

Authored by vitalybuka on Oct 20 2021, 9:12 PM.

Details

Summary

Transformations may strip the attribute from the
argument, e.g. for unused, which will result in
shadow offsets mismatch between caller and
callee.

Stripping noundef for used arguments can be
a problem, as TLS is not going to be set
by caller. However this is not the goal of the
patch and I am not aware if that's even
possible.

Diff Detail

Event Timeline

vitalybuka created this revision.Oct 20 2021, 9:12 PM
vitalybuka requested review of this revision.Oct 20 2021, 9:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 20 2021, 9:12 PM
kda accepted this revision.Oct 21 2021, 9:39 AM

LGTM

This revision is now accepted and ready to land.Oct 21 2021, 9:39 AM
kstoimenov accepted this revision.Oct 21 2021, 10:08 AM
kstoimenov added inline comments.
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
3712–3751

Consider converting this to "else if (ByVal)" to reduce indentation level.

vitalybuka added inline comments.Oct 21 2021, 12:54 PM
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
3712–3751

Plain conversion will not work. There is IRB.CreateStore(getOrigin(A) which shared for both non EagerCheck branches

kstoimenov added inline comments.Oct 21 2021, 1:09 PM
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
3712–3751

That makes sense. Let's keep as is.

eugenis accepted this revision.Oct 21 2021, 3:53 PM

LGTM

I agree it is a little bit scary that noundef can be removed from an argument - msan appears to put more requirements on the attribute than the rest of llvm (it's a call abi attribute for msan, not just optimization).

This revision was landed with ongoing or failed builds.Oct 21 2021, 6:35 PM
This revision was automatically updated to reflect the committed changes.