Re: [PATCH v3 2/5] kasan/Makefile: Support LLVM style asan parameters.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 4, 2017 at 8:14 AM, Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> wrote:

On 12/02/2017 12:36 AM, Paul Lawrence wrote:
>

Missing:
        From: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx>

Please, don't change authorship of the patches.

​Sorry - I'll fix this when I next upload.​

> LLVM doesn't understand GCC-style paramters ("--param asan-foo=bar"),
> thus we currently we don't use inline/globals/stack instrumentation
> when building the kernel with clang.
>
> Add support for LLVM-style parameters ("-mllvm -asan-foo=bar") to
> enable all KASAN features.
>
> Signed-off-by: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx>
> ---
>  scripts/Makefile.kasan | 29 ++++++++++++++++++-----------
>  1 file changed, 18 insertions(+), 11 deletions(-)
>
> diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan
> index 1ce7115aa499..7c00be9216f4 100644
> --- a/scripts/Makefile.kasan
> +++ b/scripts/Makefile.kasan
> @@ -10,10 +10,7 @@ KASAN_SHADOW_OFFSET ?= $(CONFIG_KASAN_SHADOW_OFFSET)
>



> +   # -fasan-shadow-offset fails without -fsanitize
> +   CFLAGS_KASAN_SHADOW := $(call cc-option, -fsanitize=kernel-address \
> +                     -fasan-shadow-offset=$(KASAN_SHADOW_OFFSET), \
> +                     $(call cc-option, -fsanitize=kernel-address \
> +                     -mllvm -asan-mapping-offset=$(KASAN_SHADOW_OFFSET)))
> +
> +   ifeq ("$(CFLAGS_KASAN_SHADOW)"," ")

This not how it was in my original patch. Why you changed this?
Condition is always false now, so it breaks kasan with 4.9.x gcc.

​I had the opposite problem - CFLAGS_KASAN_SHADOW is always at least a space, and the
original condition would always be false, which is why I changed it.​ On investigation, I found 
that if the line was split it would always be a space - $(false,whatever,empty-string) would be
truly empty, but if the line was split after the second comma it would be one space. Is this a
difference in our make systems?


> +      CFLAGS_KASAN := $(CFLAGS_KASAN_MINIMAL)
> +   else
> +      # Now add all the compiler specific options that are valid standalone
> +      CFLAGS_KASAN := $(CFLAGS_KASAN_SHADOW) \
> +     $(call cc-param,asan-globals=1) \


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux