add configuration for canaries
parent
96c538d90f
commit
fc2473e7ee
1
config.h
1
config.h
|
@ -5,5 +5,6 @@
|
||||||
#define WRITE_AFTER_FREE_CHECK true
|
#define WRITE_AFTER_FREE_CHECK true
|
||||||
#define SLOT_RANDOMIZE true
|
#define SLOT_RANDOMIZE true
|
||||||
#define ZERO_ON_FREE true
|
#define ZERO_ON_FREE true
|
||||||
|
#define SLAB_CANARY true
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
2
malloc.c
2
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");
|
static_assert(!WRITE_AFTER_FREE_CHECK || ZERO_ON_FREE, "WRITE_AFTER_FREE_CHECK depends on ZERO_ON_FREE");
|
||||||
|
|
||||||
// either sizeof(uint64_t) or 0
|
// 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
|
#define CACHELINE_SIZE 64
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue