From 67ada4d3095c061cd2450ab6884234a04907e02e Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Mon, 15 Oct 2018 19:08:20 -0400 Subject: [PATCH] document padding for allocator state --- malloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/malloc.c b/malloc.c index a522d11..5ba8b8b 100644 --- a/malloc.c +++ b/malloc.c @@ -556,11 +556,14 @@ struct region_allocator { struct random_state rng; }; -struct allocator_state { +struct __attribute__((aligned(PAGE_SIZE))) allocator_state { struct size_class size_class_metadata[N_SIZE_CLASSES]; struct region_allocator region_allocator; + // padding until next page boundary for mprotect struct region_metadata regions_a[MAX_REGION_TABLE_SIZE] __attribute__((aligned(PAGE_SIZE))); + // padding until next page boundary for mprotect struct region_metadata regions_b[MAX_REGION_TABLE_SIZE] __attribute__((aligned(PAGE_SIZE))); + // padding until next page boundary for mprotect }; static void regions_quarantine_deallocate_pages(void *p, size_t size, size_t guard_size) {