This is an archive of the discontinued LLVM Phabricator instance.

scudo: Split setRandomTag in two. NFCI.
ClosedPublic

Authored by pcc on Dec 8 2020, 12:51 PM.

Details

Summary

Separate the IRG part from the STZG part since we will need to use
the latter on its own for some upcoming changes.

Diff Detail

Event Timeline

pcc requested review of this revision.Dec 8 2020, 12:51 PM
pcc created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 8 2020, 12:51 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
hctim accepted this revision.Dec 9 2020, 9:36 AM

LGTM w/ nits.

compiler-rt/lib/scudo/standalone/memtag.h
106–122

Worth a DCHECK that Begin and End are granule-aligned (and in selectRandomTag)?

107

Probably better to be safe and make this if (Begin < End)?

This revision is now accepted and ready to land.Dec 9 2020, 9:36 AM
pcc added inline comments.Dec 9 2020, 11:15 AM
compiler-rt/lib/scudo/standalone/memtag.h
106–122

End doesn't need to be granule-aligned (we can pass an unaligned End from the primary allocator). This is the reason why we return the address of the end of the tagged region instead of just letting the caller use End. I suppose that we could check Begin here though.

107

I'm not sure about that. I think that if Begin > End we will want to crash here (i.e. the likely source of the bug) instead of at some indeterminate point later.

This revision was landed with ongoing or failed builds.Dec 9 2020, 11:49 AM
This revision was automatically updated to reflect the committed changes.