From 61821b02c8615bc9f359497686b3ac952ddb56f3 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 16 Nov 2023 17:49:11 +0100 Subject: [PATCH] Clarify a bit why a particular magic number was chosen --- h_malloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/h_malloc.c b/h_malloc.c index ffcf0e4..014b461 100644 --- a/h_malloc.c +++ b/h_malloc.c @@ -495,7 +495,8 @@ static void set_slab_canary_value(UNUSED struct slab_metadata *metadata, UNUSED // When MTE is enabled, writing and reading of canaries is disabled, i.e. canary remains zeroed. // After MTE is disabled, canaries that are set to 0 are ignored, since they wouldn't match // slab's metadata->canary_value. - metadata->canary_value = 0x100; // 0x100 was chosen as the smallest acceptable value + // 0x100 was chosen arbitrarily, and can be encoded as an immediate value on ARM by the compiler. + metadata->canary_value = 0x100; } #endif #endif