This was a nice performance improvement but slot randomization still has a fair bit of overhead, despite being one of the least important security features:
github.com/AndroidHardeni
There are clear ways of speeding it up further but most of the cost is back to being the CSPRNG.
Conversation
Replying to
There will be a couple other uses of the CSPRNG in hot paths so improving that will be a priority now. The CSPRNG is currently a scalar ChaCha8 implementation so there's a lot of room for improvement with SIMD or switching to using AES when hardware acceleration is available.
1
Another potential performance issue will be preserving double-free detection when the slab allocation quarantine is merged. The fastest approach is adding another set of bitmaps tracking which slots are quarantined, rather than the hash table approach I took for my previous work.
1
That's a bit unfortunate, since for 16 byte allocations that means adding 32 bytes of metadata per slab, since that size class uses 256 slots per page. It will end up bloating the slab metadata beyond a single cacheline. I don't really see a decent alternative to that though.
