[<prev] [next>] [day] [month] [year] [list]
Message-Id: <de4587d6a719232e83c760113e46ed2d4d8da61e.1646757322.git.andreyknvl@google.com>
Date: Tue, 8 Mar 2022 17:54:17 +0100
From: andrey.konovalov@...ux.dev
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Andrey Konovalov <andreyknvl@...il.com>,
Marco Elver <elver@...gle.com>,
Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Andrey Ryabinin <ryabinin.a.a@...il.com>,
kasan-dev@...glegroups.com, Vasily Gorbik <gor@...ux.ibm.com>,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Andrey Konovalov <andreyknvl@...gle.com>
Subject: [PATCH mm] fix for "kasan, vmalloc: only tag normal vmalloc allocations"
From: Andrey Konovalov <andreyknvl@...gle.com>
"kasan, vmalloc: only tag normal vmalloc allocations" unintentionally
disabled poisoning of executable memory for the Generic mode. Fix it.
Reported-by: Vasily Gorbik <gor@...ux.ibm.com>
Signed-off-by: Andrey Konovalov <andreyknvl@...gle.com>
---
mm/kasan/shadow.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/mm/kasan/shadow.c b/mm/kasan/shadow.c
index 7272e248db87..a4f07de21771 100644
--- a/mm/kasan/shadow.c
+++ b/mm/kasan/shadow.c
@@ -489,10 +489,11 @@ void *__kasan_unpoison_vmalloc(const void *start, unsigned long size,
return (void *)start;
/*
- * Don't tag executable memory.
+ * Don't tag executable memory with the tag-based mode.
* The kernel doesn't tolerate having the PC register tagged.
*/
- if (!(flags & KASAN_VMALLOC_PROT_NORMAL))
+ if (IS_ENABLED(CONFIG_KASAN_SW_TAGS) &&
+ !(flags & KASAN_VMALLOC_PROT_NORMAL))
return (void *)start;
start = set_tag(start, kasan_random_tag());
--
2.25.1
Powered by blists - more mailing lists