Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1682748 > unrolled thread

[PATCH 3/4] kasan: support LLVM-style asan parameters

Started byGreg Hackmann <ghackmann@google.com>
First post2017-07-07 00:10 +0200
Last post2017-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.


Contents

  [PATCH 3/4] kasan: support LLVM-style asan parameters Greg Hackmann <ghackmann@google.com> - 2017-07-07 00:10 +0200
    Re: [PATCH 3/4] kasan: support LLVM-style asan parameters Dmitry Vyukov <dvyukov@google.com> - 2017-07-10 10:50 +0200

#1682748 — [PATCH 3/4] kasan: support LLVM-style asan parameters

FromGreg Hackmann <ghackmann@google.com>
Date2017-07-07 00:10 +0200
Subject[PATCH 3/4] kasan: support LLVM-style asan parameters
Message-ID<u0n8e-3bI-15@gated-at.bofh.it>
Use cc-option to figure out whether the compiler's sanitizer uses
LLVM-style parameters ("-mllvm -asan-foo=bar") or GCC-style parameters
("--param asan-foo=bar").

Signed-off-by: Greg Hackmann <ghackmann@google.com>
---
 scripts/Makefile.kasan | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan
index 9576775a86f6..b66ae4b4546b 100644
--- a/scripts/Makefile.kasan
+++ b/scripts/Makefile.kasan
@@ -9,11 +9,19 @@ KASAN_SHADOW_OFFSET ?= $(CONFIG_KASAN_SHADOW_OFFSET)
 
 CFLAGS_KASAN_MINIMAL := -fsanitize=kernel-address
 
-CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \
+CFLAGS_KASAN_GCC := $(call cc-option, -fsanitize=kernel-address \
 		-fasan-shadow-offset=$(KASAN_SHADOW_OFFSET) \
 		--param asan-stack=1 --param asan-globals=1 \
 		--param asan-instrumentation-with-call-threshold=$(call_threshold))
 
+CFLAGS_KASAN_LLVM := $(call cc-option, -fsanitize=kernel-address \
+		-mllvm -asan-mapping-offset=$(KASAN_SHADOW_OFFSET) \
+		-mllvm -asan-stack=1 -mllvm -asan-globals=1 \
+		-mllvm -asan-use-after-scope=1 \
+		-mllvm -asan-instrumentation-with-call-threshold=$(call_threshold))
+
+CFLAGS_KASAN := $(CFLAGS_KASAN_GCC) $(CFLAGS_KASAN_LLVM)
+
 ifeq ($(call cc-option, $(CFLAGS_KASAN_MINIMAL) -Werror),)
    ifneq ($(CONFIG_COMPILE_TEST),y)
         $(warning Cannot use CONFIG_KASAN: \
-- 
2.13.2.725.g09c95d1e9-goog

[toc] | [next] | [standalone]


#1684054

FromDmitry Vyukov <dvyukov@google.com>
Date2017-07-10 10:50 +0200
Message-ID<u1Cyd-2Hm-5@gated-at.bofh.it>
In reply to#1682748
On Fri, Jul 7, 2017 at 12:01 AM, Greg Hackmann <ghackmann@google.com> wrote:
> Use cc-option to figure out whether the compiler's sanitizer uses
> LLVM-style parameters ("-mllvm -asan-foo=bar") or GCC-style parameters
> ("--param asan-foo=bar").
>
> Signed-off-by: Greg Hackmann <ghackmann@google.com>
> ---
>  scripts/Makefile.kasan | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan
> index 9576775a86f6..b66ae4b4546b 100644
> --- a/scripts/Makefile.kasan
> +++ b/scripts/Makefile.kasan
> @@ -9,11 +9,19 @@ KASAN_SHADOW_OFFSET ?= $(CONFIG_KASAN_SHADOW_OFFSET)
>
>  CFLAGS_KASAN_MINIMAL := -fsanitize=kernel-address
>
> -CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \
> +CFLAGS_KASAN_GCC := $(call cc-option, -fsanitize=kernel-address \
>                 -fasan-shadow-offset=$(KASAN_SHADOW_OFFSET) \
>                 --param asan-stack=1 --param asan-globals=1 \
>                 --param asan-instrumentation-with-call-threshold=$(call_threshold))
>
> +CFLAGS_KASAN_LLVM := $(call cc-option, -fsanitize=kernel-address \
> +               -mllvm -asan-mapping-offset=$(KASAN_SHADOW_OFFSET) \
> +               -mllvm -asan-stack=1 -mllvm -asan-globals=1 \
> +               -mllvm -asan-use-after-scope=1 \
> +               -mllvm -asan-instrumentation-with-call-threshold=$(call_threshold))
> +
> +CFLAGS_KASAN := $(CFLAGS_KASAN_GCC) $(CFLAGS_KASAN_LLVM)
> +
>  ifeq ($(call cc-option, $(CFLAGS_KASAN_MINIMAL) -Werror),)
>     ifneq ($(CONFIG_COMPILE_TEST),y)
>          $(warning Cannot use CONFIG_KASAN: \

Reviewed-by: Dmitry Vyukov <dvyukov@google.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web