* [PATCH mm] fix for "kasan, vmalloc: only tag normal vmalloc allocations"
@ 2022-03-08 16:54 andrey.konovalov
0 siblings, 0 replies; only message in thread
From: andrey.konovalov @ 2022-03-08 16:54 UTC (permalink / raw)
To: Andrew Morton
Cc: Andrey Konovalov, Marco Elver, Alexander Potapenko,
Dmitry Vyukov, Andrey Ryabinin, kasan-dev, Vasily Gorbik,
linux-mm, linux-kernel, Andrey Konovalov
From: Andrey Konovalov <andreyknvl@google.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@linux.ibm.com>
Signed-off-by: Andrey Konovalov <andreyknvl@google.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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-03-08 16:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-08 16:54 [PATCH mm] fix for "kasan, vmalloc: only tag normal vmalloc allocations" andrey.konovalov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox