[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <9230ca3d3e40ffca041c133a524191fd71969a8d.1646233925.git.andreyknvl@google.com>
Date: Wed, 2 Mar 2022 16:13:30 +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, Will Deacon <will@...nel.org>,
Sami Tolvanen <samitolvanen@...gle.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Andrey Konovalov <andreyknvl@...gle.com>
Subject: [PATCH mm 1/2] fix for "kasan, vmalloc: only tag normal vmalloc allocations"
From: Andrey Konovalov <andreyknvl@...gle.com>
Pass KASAN_VMALLOC_PROT_NORMAL to kasan_unpoison_vmalloc() in the custom
KASAN instrumentation for Shadow Call Stack, as Shadow Call Stack mappings
are not executable and thus can be poisoned.
Signed-off-by: Andrey Konovalov <andreyknvl@...gle.com>
---
kernel/scs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/scs.c b/kernel/scs.c
index b83bc9251f99..1033a76a3284 100644
--- a/kernel/scs.c
+++ b/kernel/scs.c
@@ -32,7 +32,8 @@ static void *__scs_alloc(int node)
for (i = 0; i < NR_CACHED_SCS; i++) {
s = this_cpu_xchg(scs_cache[i], NULL);
if (s) {
- kasan_unpoison_vmalloc(s, SCS_SIZE, KASAN_VMALLOC_NONE);
+ kasan_unpoison_vmalloc(s, SCS_SIZE,
+ KASAN_VMALLOC_PROT_NORMAL);
memset(s, 0, SCS_SIZE);
return s;
}
@@ -78,7 +79,7 @@ void scs_free(void *s)
if (this_cpu_cmpxchg(scs_cache[i], 0, s) == NULL)
return;
- kasan_unpoison_vmalloc(s, SCS_SIZE, KASAN_VMALLOC_NONE);
+ kasan_unpoison_vmalloc(s, SCS_SIZE, KASAN_VMALLOC_PROT_NORMAL);
vfree_atomic(s);
}
--
2.25.1
Powered by blists - more mailing lists