linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kasan: turn on -fsanitize-address-use-after-scope
@ 2016-12-08 12:48 Andrey Ryabinin
  2016-12-08 14:34 ` Dmitry Vyukov
  0 siblings, 1 reply; 3+ messages in thread
From: Andrey Ryabinin @ 2016-12-08 12:48 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Alexander Potapenko, Dmitry Vyukov, andreyknvl, kasan-dev,
	linux-kernel, Andrey Ryabinin

In the upcoming gcc7 release release, the -fsanitize=kernel-address option
at first implied new -fsanitize-address-use-after-scope option.
This would cause link errors on older kernels because they don't have
two new functions required for use-after-scope support. Therefore,
gcc7 changed default to -fno-sanitize-address-use-after-scope.

Now the kernel has everything required for that feature since
commit 828347f8f9a5 ("kasan: support use-after-scope detection").
So, to make it work, we just have to enable use-after-scope in CFLAGS.

Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 scripts/Makefile.kasan | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan
index 37323b0..9576775 100644
--- a/scripts/Makefile.kasan
+++ b/scripts/Makefile.kasan
@@ -28,4 +28,6 @@ else
         CFLAGS_KASAN := $(CFLAGS_KASAN_MINIMAL)
     endif
 endif
+
+CFLAGS_KASAN += $(call cc-option, -fsanitize-address-use-after-scope)
 endif
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kasan: turn on -fsanitize-address-use-after-scope
  2016-12-08 12:48 [PATCH] kasan: turn on -fsanitize-address-use-after-scope Andrey Ryabinin
@ 2016-12-08 14:34 ` Dmitry Vyukov
  2016-12-08 14:39   ` [PATCH v2] " Andrey Ryabinin
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Vyukov @ 2016-12-08 14:34 UTC (permalink / raw)
  To: Andrey Ryabinin
  Cc: Andrew Morton, Alexander Potapenko, andreyknvl, kasan-dev, LKML

On Thu, Dec 8, 2016 at 1:48 PM, Andrey Ryabinin <aryabinin@virtuozzo.com> wrote:
> In the upcoming gcc7 release release, the -fsanitize=kernel-address option
> at first implied new -fsanitize-address-use-after-scope option.
> This would cause link errors on older kernels because they don't have
> two new functions required for use-after-scope support. Therefore,
> gcc7 changed default to -fno-sanitize-address-use-after-scope.
>
> Now the kernel has everything required for that feature since
> commit 828347f8f9a5 ("kasan: support use-after-scope detection").
> So, to make it work, we just have to enable use-after-scope in CFLAGS.
>
> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> ---
>  scripts/Makefile.kasan | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan
> index 37323b0..9576775 100644
> --- a/scripts/Makefile.kasan
> +++ b/scripts/Makefile.kasan
> @@ -28,4 +28,6 @@ else
>          CFLAGS_KASAN := $(CFLAGS_KASAN_MINIMAL)
>      endif
>  endif
> +
> +CFLAGS_KASAN += $(call cc-option, -fsanitize-address-use-after-scope)
>  endif
> --

Doubled word "release release" on the first line of description.
But otherwise:
Acked-by: Dmitry Vyukov <dvyukov@google.com>

I've just submitted the corresponding gcc change:
https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=243441

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] kasan: turn on -fsanitize-address-use-after-scope
  2016-12-08 14:34 ` Dmitry Vyukov
@ 2016-12-08 14:39   ` Andrey Ryabinin
  0 siblings, 0 replies; 3+ messages in thread
From: Andrey Ryabinin @ 2016-12-08 14:39 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Alexander Potapenko, Dmitry Vyukov, andreyknvl, kasan-dev,
	linux-kernel, Andrey Ryabinin

In the upcoming gcc7 release, the -fsanitize=kernel-address option
at first implied new -fsanitize-address-use-after-scope option.
This would cause link errors on older kernels because they don't have
two new functions required for use-after-scope support. Therefore,
gcc7 changed default to -fno-sanitize-address-use-after-scope.

Now the kernel has everything required for that feature since
commit 828347f8f9a5 ("kasan: support use-after-scope detection").
So, to make it work, we just have to enable use-after-scope in CFLAGS.

Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Acked-by: Dmitry Vyukov <dvyukov@google.com>
---
Changes since v1:
   - s/release release/relase in changelog
   - added Ack

 scripts/Makefile.kasan | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan
index 37323b0..9576775 100644
--- a/scripts/Makefile.kasan
+++ b/scripts/Makefile.kasan
@@ -28,4 +28,6 @@ else
         CFLAGS_KASAN := $(CFLAGS_KASAN_MINIMAL)
     endif
 endif
+
+CFLAGS_KASAN += $(call cc-option, -fsanitize-address-use-after-scope)
 endif
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-08 17:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-08 12:48 [PATCH] kasan: turn on -fsanitize-address-use-after-scope Andrey Ryabinin
2016-12-08 14:34 ` Dmitry Vyukov
2016-12-08 14:39   ` [PATCH v2] " Andrey Ryabinin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).