Skip to content

Commit 3ca29d6

Browse files
committed
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.
1 parent 01b282a commit 3ca29d6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/pal/pal_posix.h

+3
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ namespace snmalloc
135135
{
136136
SNMALLOC_ASSERT(is_aligned_block<OS::page_size>(p, size));
137137
#ifdef USE_POSIX_COMMIT_CHECKS
138+
// Fill memory so that when we switch the pages back on we don't make
139+
// assumptions on the content.
140+
memset(p, 0x5a, size);
138141
mprotect(p, size, PROT_NONE);
139142
#else
140143
UNUSED(p);

0 commit comments

Comments
 (0)