This is an archive of the discontinued LLVM Phabricator instance.

[scudo] Fix MTE crash in storeEndMarker.
ClosedPublic

Authored by eugenis on Nov 16 2021, 12:18 PM.

Details

Summary

The bounds check in storeEndMarker incorrectly compares tagged against
untagged address in the in-place realloc case. This can cause the tag
store to go into an unmapped page to the right of the region mapping.

Diff Detail

Event Timeline

eugenis created this revision.Nov 16 2021, 12:18 PM
eugenis requested review of this revision.Nov 16 2021, 12:18 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 16 2021, 12:18 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
hctim added inline comments.Nov 16 2021, 12:25 PM
compiler-rt/lib/scudo/standalone/combined.h
1167 ↗(On Diff #387732)

this invariant no longer relevant?

pcc added inline comments.Nov 16 2021, 12:29 PM
compiler-rt/lib/scudo/standalone/combined.h
1169 ↗(On Diff #387732)

Can we fix the caller to untag BlockEnd instead?

pcc added inline comments.Nov 16 2021, 12:35 PM
compiler-rt/lib/scudo/standalone/combined.h
1169 ↗(On Diff #387732)

...which we already did in D105261. I reckon we'll need to cherry-pick that everywhere.

eugenis updated this revision to Diff 387735.Nov 16 2021, 12:45 PM

Remove the fix, keep the test.

compiler-rt/lib/scudo/standalone/combined.h
1169 ↗(On Diff #387732)

Oh right. I hacked this on an older version of the code :(

pcc accepted this revision.Nov 16 2021, 12:48 PM

LGTM

This revision is now accepted and ready to land.Nov 16 2021, 12:48 PM