From fc2473e7ee98b509129f760a0099387c6b173bfb Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Fri, 7 Sep 2018 00:35:08 -0400 Subject: [PATCH] add configuration for canaries --- config.h | 1 + malloc.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config.h b/config.h index 822bf6d..0a701a7 100644 --- a/config.h +++ b/config.h @@ -5,5 +5,6 @@ #define WRITE_AFTER_FREE_CHECK true #define SLOT_RANDOMIZE true #define ZERO_ON_FREE true +#define SLAB_CANARY true #endif diff --git a/malloc.c b/malloc.c index a0cd0e4..0a5f743 100644 --- a/malloc.c +++ b/malloc.c @@ -23,7 +23,7 @@ static_assert(sizeof(void *) == 8, "64-bit only"); static_assert(!WRITE_AFTER_FREE_CHECK || ZERO_ON_FREE, "WRITE_AFTER_FREE_CHECK depends on ZERO_ON_FREE"); // either sizeof(uint64_t) or 0 -static const size_t canary_size = sizeof(uint64_t); +static const size_t canary_size = SLAB_CANARY ? sizeof(uint64_t) : 0; #define CACHELINE_SIZE 64