Add a knob for whether to allow guard pages in memory allocations done via mmapInternal(). The knob defaults to false.

This commit is contained in:
Steve Atherton 2022-10-16 19:55:07 -07:00
parent d40f1555bb
commit d169875423
3 changed files with 3 additions and 1 deletions

View File

@ -73,6 +73,7 @@ void FlowKnobs::initialize(Randomize randomize, IsSimulated isSimulated) {
init( RANDOMSEED_RETRY_LIMIT, 4 );
init( FAST_ALLOC_LOGGING_BYTES, 10e6 );
init( FAST_ALLOC_ALLOW_GUARD_PAGES, false );
init( HUGE_ARENA_LOGGING_BYTES, 100e6 );
init( HUGE_ARENA_LOGGING_INTERVAL, 5.0 );

View File

@ -2126,7 +2126,7 @@ static void mprotectSafe(void* p, size_t s, int prot) {
}
static void* mmapInternal(size_t length, int flags, bool guardPages) {
if (guardPages) {
if (guardPages && FLOW_KNOBS->FAST_ALLOC_ALLOW_GUARD_PAGES) {
static size_t pageSize = sysconf(_SC_PAGESIZE);
length = RightAlign(length, pageSize);
length += 2 * pageSize; // Map enough for the guard pages

View File

@ -131,6 +131,7 @@ public:
int RANDOMSEED_RETRY_LIMIT;
double FAST_ALLOC_LOGGING_BYTES;
bool FAST_ALLOC_ALLOW_GUARD_PAGES;
double HUGE_ARENA_LOGGING_BYTES;
double HUGE_ARENA_LOGGING_INTERVAL;