XOR encoded next_object

This commit adds a simple XOR encoding to the next_object pointer in
FreeObjects.  This removes the trivial way of getting hold of a physical
address from the system by observing the free list pointers in
deallocated objects.
This commit is contained in:
Matthew Parkinson
2021-07-26 09:56:48 +01:00
committed by Matthew Parkinson
parent b69505fc5d
commit 81bf341732
9 changed files with 136 additions and 65 deletions

View File

@@ -76,7 +76,7 @@ namespace snmalloc
typename SharedStateHandle>
bool flush(DeallocFun dealloc, SharedStateHandle handle)
{
FreeListKey key(entropy.get_constant_key());
auto& key = entropy.get_free_list_key();
// Return all the free lists to the allocator.
// Used during thread teardown
@@ -98,7 +98,7 @@ namespace snmalloc
template<ZeroMem zero_mem, typename SharedStateHandle, typename Slowpath>
SNMALLOC_FAST_PATH void* alloc(size_t size, Slowpath slowpath)
{
FreeListKey key(entropy.get_constant_key());
auto& key = entropy.get_free_list_key();
sizeclass_t sizeclass = size_to_sizeclass(size);
stats.alloc_request(size);