From b560431c017dff5fc5901197aaeb3e818ac842c1 Mon Sep 17 00:00:00 2001 From: Dmitry Muhomor Date: Mon, 30 Oct 2023 12:31:12 +0200 Subject: [PATCH] mte: note why 0 tag is excluded --- h_malloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/h_malloc.c b/h_malloc.c index aff5211..5fa2863 100644 --- a/h_malloc.c +++ b/h_malloc.c @@ -577,7 +577,8 @@ static void *tag_and_clear_slab_slot(struct slab_metadata *metadata, void *slot_ // is constructed. u8 *slot_tags = metadata->arm_mte_tags; - // Tag exclusion mask + // Tag exclusion mask. 0 tag is always excluded to detect accesses to slab memory via untagged + // pointers. Moreover, 0 tag is excluded in bionic via PR_MTE_TAG_MASK prctl u64 tem = (1 << 0) | (1 << RESERVED_TAG); // current or previous tag of left neighbor or 0 if there's no left neighbor or if it was never used