This is an archive of the discontinued LLVM Phabricator instance.

[NFC][msan] Don't setOrigin for byval pointer
ClosedPublic

Authored by vitalybuka on Jan 13 2022, 10:06 PM.

Details

Summary

It's NFC because shadow of pointer is clean so origins will not be
propagated anyway.

Depends on D117275

Diff Detail

Event Timeline

vitalybuka created this revision.Jan 13 2022, 10:06 PM
vitalybuka requested review of this revision.Jan 13 2022, 10:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 13 2022, 10:06 PM

This does not look right. We may not always check that the shadow is constant zero before accessing origin. Note that getOrigin() wants origins to be available for all values.

a = b + c
Sa = Sb | Sc
Oa = Sb ? Ob : Oc;  // <= this will attempt getOrigin(c) without looking at Sc.

In any case, there are other places in the pass with the same pattern.

vitalybuka added a comment.EditedJan 14 2022, 12:58 PM

This does not look right. We may not always check that the shadow is constant zero before accessing origin. Note that getOrigin() wants origins to be available for all values.

a = b + c
Sa = Sb | Sc
Oa = Sb ? Ob : Oc;  // <= this will attempt getOrigin(c) without looking at Sc.

Yes, but after the patch I call more setOrigin(A, getCleanOrigin()); not less

To clarify:
the only changed case is (TrackOrigin && !Overflow && ByVal)
Before the patch: setOrigin(A, ... unrelated nonsense)
After the patch: setOrigin(A,getClean())

eugenis accepted this revision.Jan 14 2022, 1:05 PM

Hmm I somehow managed to read your patch backwards :)

LGTM

This revision is now accepted and ready to land.Jan 14 2022, 1:05 PM
kda edited the summary of this revision. (Show Details)Jan 14 2022, 2:42 PM
kda accepted this revision.Jan 14 2022, 2:45 PM
This revision was automatically updated to reflect the committed changes.