This is an archive of the discontinued LLVM Phabricator instance.

scudo: Check for UAF in ring buffer before OOB in more distant blocks.
ClosedPublic

Authored by pcc on May 12 2021, 5:07 PM.

Details

Summary

It's more likely that we have a UAF than an OOB in blocks that are
more than 1 block away from the fault address, so the UAF should
appear first in the error report.

Diff Detail

Event Timeline

pcc requested review of this revision.May 12 2021, 5:07 PM
pcc created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMay 12 2021, 5:07 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
eugenis added inline comments.May 13 2021, 5:49 PM
compiler-rt/lib/scudo/standalone/combined.h
1325

Did you mean

if (CheckOOB(Info.BlockBegin) || MinDistance == 0)

?

pcc added inline comments.May 13 2021, 5:54 PM
compiler-rt/lib/scudo/standalone/combined.h
1325

I think that would result in us not checking the surrounding blocks if MinDistance == 0, even if MaxDistance was some larger number.

eugenis accepted this revision.May 13 2021, 6:04 PM

LGTM

This revision is now accepted and ready to land.May 13 2021, 6:04 PM