[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACT4Y+b4btzSD1vJDa30o+67uq-sgFnU0FBEAfL9xrT7GyC9HQ@mail.gmail.com>
Date: Thu, 30 Nov 2017 09:31:27 +0100
From: Dmitry Vyukov <dvyukov@...gle.com>
To: Paul Lawrence <paullawrence@...gle.com>
Cc: Andrey Ryabinin <aryabinin@...tuozzo.com>,
Alexander Potapenko <glider@...gle.com>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Michal Marek <mmarek@...e.com>,
LKML <linux-kernel@...r.kernel.org>,
kasan-dev <kasan-dev@...glegroups.com>,
Linux-MM <linux-mm@...ck.org>,
"open list:KERNEL BUILD + fi..." <linux-kbuild@...r.kernel.org>,
Matthias Kaehlcke <mka@...omium.org>,
Michael Davidson <md@...gle.com>,
Greg Hackmann <ghackmann@...gle.com>
Subject: Re: [PATCH v2 3/5] kasan: added functions for unpoisoning stack variables
On Wed, Nov 29, 2017 at 10:50 PM, 'Paul Lawrence' via kasan-dev
<kasan-dev@...glegroups.com> wrote:
> From: Alexander Potapenko <glider@...gle.com>
>
> 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.
>
> Signed-off-by: Alexander Potapenko <glider@...gle.com>
> [ghackmann@...gle.com: fix memset() parameters, and tweak
> commit message to describe new callbacks]
> Signed-off-by: Greg Hackmann <ghackmann@...gle.com>
> Signed-off-by: Paul Lawrence <paullawrence@...gle.com>
>
> ---
> mm/kasan/kasan.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c
> index f86f862f41f8..89565a1ec417 100644
> --- a/mm/kasan/kasan.c
> +++ b/mm/kasan/kasan.c
> @@ -768,6 +768,21 @@ void __asan_allocas_unpoison(const void *stack_top, const void *stack_bottom)
> }
> 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)
Reviewed-by: Dmitry Vyukov <dvyukov@...gle.com>
Powered by blists - more mailing lists