Enable guard pages in CHECK_CLIENT
Change the behaviour to use PROT_NONE for reservations in CHECK_CLIENT mode. This means that we only provide access once data is actually being used.
This commit is contained in:
committed by
Matthew Parkinson
parent
02d2ab8f7e
commit
9df0101dfd
@@ -37,10 +37,16 @@ namespace snmalloc
|
||||
|
||||
int log2align = static_cast<int>(bits::next_pow2_bits(size));
|
||||
|
||||
#ifdef SNMALLOC_CHECK_CLIENT
|
||||
auto prot = committed ? PROT_READ | PROT_WRITE : PROT_NONE;
|
||||
#else
|
||||
auto prot = PROT_READ | PROT_WRITE;
|
||||
#endif
|
||||
|
||||
void* p = mmap(
|
||||
nullptr,
|
||||
size,
|
||||
PROT_READ | PROT_WRITE,
|
||||
prot,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS | MAP_ALIGNED(log2align),
|
||||
-1,
|
||||
0);
|
||||
|
||||
Reference in New Issue
Block a user