From 9a593075205a31355e1458b654a1d307c013198f Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 26 Jul 2018 13:22:57 +0300 Subject: [PATCH] mtag: turn off mtag stuff for 32 bit builds I'm not really comfortable with this, but for now I don't want to think about 32 bit systems. The issue is that I'm mtags are a hash and ideally they are unique. I use 1 bit for if it's an alias or a base mtag, and 12 bits for the offset and on 32 bit systems that would leave only 19 bits for the hash. It feels like we would get all kinds of collisions. Signed-off-by: Dan Carpenter --- smatch_mtag.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/smatch_mtag.c b/smatch_mtag.c index 7fb25a82..2fb5b3c5 100644 --- a/smatch_mtag.c +++ b/smatch_mtag.c @@ -421,6 +421,18 @@ void register_mtag(int id) { my_id = id; + + /* + * The mtag stuff only works on 64 systems because we store the + * information in the pointer itself. + * bit 63 : set for alias mtags + * bit 62-12: mtag hash + * bit 11-0 : offset + * + */ + if (bits_in_pointer != 64) + return; + add_hook(&global_variable, BASE_HOOK); add_function_assign_hook("kmalloc", &alloc_assign, NULL); -- 2.11.4.GIT