Make POSIX COMMIT CHECKS mode fill memory
This simulates the pages being switched off with unexpected content, and thus, when turned on we don't assume they have been unchanged.
This commit is contained in:
committed by
Matthew Parkinson
parent
01b282a5f3
commit
3ca29d6f50
@@ -135,6 +135,9 @@ namespace snmalloc
|
||||
{
|
||||
SNMALLOC_ASSERT(is_aligned_block<OS::page_size>(p, size));
|
||||
#ifdef USE_POSIX_COMMIT_CHECKS
|
||||
// Fill memory so that when we switch the pages back on we don't make
|
||||
// assumptions on the content.
|
||||
memset(p, 0x5a, size);
|
||||
mprotect(p, size, PROT_NONE);
|
||||
#else
|
||||
UNUSED(p);
|
||||
|
||||
Reference in New Issue
Block a user