From 0b278747c78d95f499afe56944373d873d0d5430 Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Wed, 18 Mar 2020 14:49:02 +0000 Subject: [PATCH] Pal_linux mprotect bug fix When simulating decommit on Linux enable pages before zeroing. --- src/pal/pal_posix.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pal/pal_posix.h b/src/pal/pal_posix.h index 4c3a842..e15a63f 100644 --- a/src/pal/pal_posix.h +++ b/src/pal/pal_posix.h @@ -76,15 +76,15 @@ namespace snmalloc SNMALLOC_ASSERT( is_aligned_block(p, size) || (zero_mem == NoZero)); - if constexpr (zero_mem == YesZero) - static_cast(this)->template zero(p, size); - #ifdef USE_POSIX_COMMIT_CHECKS mprotect(p, size, PROT_READ | PROT_WRITE); #else UNUSED(p); UNUSED(size); #endif + + if constexpr (zero_mem == YesZero) + static_cast(this)->template zero(p, size); } /**