kasan: add functions for unpoisoning stack variables
Subsystems (2)
[email protected]
maintainerPATCH 6/114 kasan: add functions for unpoisoning stack variables
From: Alexander Potapenko <[email protected]>
Subject: kasan: add functions for unpoisoning stack variables
As a code-size optimization, LLVM builds since r279383 may bulk-manipulate the shadow region when (un)poisoning large memory blocks. This requires new callbacks that simply do an uninstrumented memset().
This fixes linking the Clang-built kernel when using KASAN.
[[email protected]: add declarations for internal functions]
[[email protected]: __asan_set_shadow_00 can be static]
[[email protected]: fix memset() parameters, and tweak commit message to describe new callbacks]
Signed-off-by Alexander Potapenko <[email protected]>
Signed-off-by Greg Hackmann <[email protected]>
Signed-off-by Paul Lawrence <[email protected]>
Signed-off-by Fengguang Wu <[email protected]>
Signed-off-by Arnd Bergmann <[email protected]>
Acked-by Andrey Ryabinin <[email protected]>
Cc Dmitry Vyukov <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Matthias Kaehlcke <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
mm/kasan/kasan.c | 15 +++++++++++++++ mm/kasan/kasan.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+)
mm/kasan/kasan.c renamed from mm/kasan/kasan.c~kasan-added-functions-for-unpoisoning-stack-variables +15 -0
@@ -770,6 +770,21 @@ void __asan_allocas_unpoison(const void }EXPORT_SYMBOL (__asan_allocas_unpoison); +/* Emitted by the compiler to [un]poison local variables. */ +#define DEFINE_ASAN_SET_SHADOW (byte) \ + void __asan_set_shadow_##byte(const void *addr, size_t size) \ + { \ + __memset((void *)addr, 0x##byte, size); \ + } \ + EXPORT_SYMBOL(__asan_set_shadow_##byte) + +DEFINE_ASAN_SET_SHADOW (00 ); +DEFINE_ASAN_SET_SHADOW (f1); +DEFINE_ASAN_SET_SHADOW (f2); +DEFINE_ASAN_SET_SHADOW (f3); +DEFINE_ASAN_SET_SHADOW (f5); +DEFINE_ASAN_SET_SHADOW (f8); +#ifdef CONFIG_MEMORY_HOTPLUG static int __meminit kasan_mem_notifier (struct notifier_block *nb,unsigned long action,void *data)
mm/kasan/kasan.h renamed from mm/kasan/kasan.h~kasan-added-functions-for-unpoisoning-stack-variables +44 -0
48 lines not on this page · raw message
_