This is an archive of the discontinued LLVM Phabricator instance.

scudo: Fix quarantine allocation when MTE enabled.
ClosedPublic

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

Details

Summary

Quarantines have always been broken when MTE is enabled because the
quarantine batch allocator fails to reset tags that may have been
left behind by a user allocation.

This was only noticed when running the Scudo unit tests with Scudo
as the system allocator because quarantines are turned off by
default on Android and the test binary turns them on by defining
__scudo_default_options, which affects the system allocator as well.

Depends on D92880

Diff Detail

Event Timeline

pcc requested review of this revision.Dec 8 2020, 12:52 PM
pcc created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 8 2020, 12:52 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
hctim accepted this revision.Dec 9 2020, 9:39 AM
hctim added inline comments.
compiler-rt/lib/scudo/standalone/combined.h
103

Are we sticking UNLIKELY around any memtag branches at this point? I feel like this might be a pain to undo when we actually have production devices that ship with this branch. Does it provide us a significant benefit?

This revision is now accepted and ready to land.Dec 9 2020, 9:39 AM
pcc added inline comments.Dec 9 2020, 11:15 AM
compiler-rt/lib/scudo/standalone/combined.h
103

Yes, I'm just being consistent with the other places where we are doing this. I don't remember if we ever measured the perf impact of UNLIKELY on non-MTE devices so maybe if we don't see a significant perf impact we could just remove them now.

This revision was automatically updated to reflect the committed changes.