This is an archive of the discontinued LLVM Phabricator instance.

[scudo] Get rid of the thread local PRNG & header salt
ClosedPublic

Authored by cryptoad on Dec 4 2017, 11:58 AM.

Details

Summary

It was deemed that the salt in the chunk header didn't improve security
significantly (and could actually decrease it). The initial idea was that the
same chunk would different headers on different allocations, allowing for less
predictability. The issue is that gathering the same chunk header with different
salts can give information about the other "secrets" (cookie, pointer), and that
if an attacker leaks a header, they can reuse it anyway for that same chunk
anyway since we don't enforce the salt value.

So we get rid of the salt in the header. This means we also get rid of the
thread local Prng, and that we don't need a global Prng anymore as well. This
makes everything faster.

We reuse those 8 bits to store the ClassId of a chunk now (0 for a secondary
based allocation). This way, we get some additional speed gains:

  • ClassId is computed outside of the locked block;
  • getActuallyAllocatedSize doesn't need the GetSizeClass call;
  • same for deallocatePrimary;

We add a sanity check at init for this new field (all sanity checks are moved
in their own function, init was getting crowded).

Event Timeline

cryptoad created this revision.Dec 4 2017, 11:58 AM
alekseyshl accepted this revision.Dec 4 2017, 6:08 PM
This revision is now accepted and ready to land.Dec 4 2017, 6:08 PM
cryptoad closed this revision.Dec 5 2017, 9:08 AM