Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1682751 > unrolled thread
| Started by | Greg Hackmann <ghackmann@google.com> |
|---|---|
| First post | 2017-07-07 00:10 +0200 |
| Last post | 2017-07-10 10:50 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 2/4] kasan: added functions for unpoisoning stack variables Greg Hackmann <ghackmann@google.com> - 2017-07-07 00:10 +0200
Re: [PATCH 2/4] kasan: added functions for unpoisoning stack variables Dmitry Vyukov <dvyukov@google.com> - 2017-07-10 10:50 +0200
| From | Greg Hackmann <ghackmann@google.com> |
|---|---|
| Date | 2017-07-07 00:10 +0200 |
| Subject | [PATCH 2/4] kasan: added functions for unpoisoning stack variables |
| Message-ID | <u0n8e-3bI-31@gated-at.bofh.it> |
From: Alexander Potapenko <glider@google.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@google.com>
[ghackmann@google.com: fix memset() parameters, and tweak
commit message to describe new callbacks]
Signed-off-by: Greg Hackmann <ghackmann@google.com>
---
mm/kasan/kasan.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c
index 892b626f564b..89911e5c69f9 100644
--- a/mm/kasan/kasan.c
+++ b/mm/kasan/kasan.c
@@ -828,6 +828,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 kasan_mem_notifier(struct notifier_block *nb,
unsigned long action, void *data)
--
2.13.2.725.g09c95d1e9-goog
[toc] | [next] | [standalone]
| From | Dmitry Vyukov <dvyukov@google.com> |
|---|---|
| Date | 2017-07-10 10:50 +0200 |
| Message-ID | <u1Cye-2Hm-29@gated-at.bofh.it> |
| In reply to | #1682751 |
On Fri, Jul 7, 2017 at 12:01 AM, Greg Hackmann <ghackmann@google.com> wrote:
> From: Alexander Potapenko <glider@google.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@google.com>
> [ghackmann@google.com: fix memset() parameters, and tweak
> commit message to describe new callbacks]
> Signed-off-by: Greg Hackmann <ghackmann@google.com>
> ---
> mm/kasan/kasan.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c
> index 892b626f564b..89911e5c69f9 100644
> --- a/mm/kasan/kasan.c
> +++ b/mm/kasan/kasan.c
> @@ -828,6 +828,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 kasan_mem_notifier(struct notifier_block *nb,
> unsigned long action, void *data)
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web