Skip to content

Commit

Permalink
Make POSIX COMMIT CHECKS mode fill memory
Browse files Browse the repository at this point in the history
This simulates the pages being switched off with unexpected content, and
thus, when turned on we don't assume they have been unchanged.
  • Loading branch information
mjp41 committed Nov 10, 2020
1 parent 01b282a commit 3ca29d6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/pal/pal_posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3ca29d6

Please sign in to comment.