Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: "Arnd Bergmann" <arnd@arndb.de>,
	"Martin Liška" <marxin@gcc.gnu.org>,
	"Andrey Ryabinin" <a.ryabinin@samsung.com>,
	stable@vger.kernel.org, "Michal Marek" <mmarek@suse.com>,
	"Alexander Potapenko" <glider@google.com>,
	"Dmitry Vyukov" <dvyukov@google.com>,
	linux-kbuild@vger.kernel.org, kasan-dev@googlegroups.com,
	linux-kernel@vger.kernel.org
Subject: [PATCH] kasan: turn off -fsanitize-address-use-after-scope for now
Date: Tue, 22 Nov 2016 23:54:06 +0100	[thread overview]
Message-ID: <20161122225424.3739294-1-arnd@arndb.de> (raw)

In the upcoming gcc-7 release, the -fsanitize=kernel-address option
implies -fsanitize-address-use-after-scope, which relies on the
definition of two global functions, causing many link errors if they
are not defined, e.g:

arch/x86/built-in.o: In function `x86_pmu_handle_irq':
(.text+0x88e6): undefined reference to `__asan_unpoison_stack_memory'
arch/x86/built-in.o: In function `x86_pmu_handle_irq':
(.text+0x8ad7): undefined reference to `__asan_poison_stack_memory'
kernel/built-in.o: In function `perf_tp_event':
(.text+0x225472): undefined reference to `__asan_unpoison_stack_memory'
kernel/built-in.o: In function `perf_tp_event':
(.text+0x22583a): undefined reference to `__asan_unpoison_stack_memory'
kernel/built-in.o: In function `perf_tp_event':
(.text+0x2258ae): undefined reference to `__asan_poison_stack_memory'
kernel/built-in.o: In function `perf_event_aux_event':

I think we really want to define those two functions so we can make
use of a helpful feature, but as I have no idea what they are supposed
to do, I'd suggest to turn the option off on existing kernels to allow
building with gcc-7 and kasan.

For some reason, the problem showed up in only a few randconfig builds,
but it is easy to reproduce using an x86-64 tinyconfig build with
CONFIG_KASAN=y.

If we decide to take this approach, we probably want to do the same
change on all stable kernels that support KASAN, i.e. v4.0 or higher.

Link: https://gcc.gnu.org/viewcvs/gcc?limit_changes=0&view=revision&revision=241896
Cc: Martin Liška <marxin@gcc.gnu.org>
Cc: Andrey Ryabinin <a.ryabinin@samsung.com>
Cc: stable@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 scripts/Makefile.kasan | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan
index 37323b0df374..0e68fef09f76 100644
--- a/scripts/Makefile.kasan
+++ b/scripts/Makefile.kasan
@@ -29,3 +29,5 @@ else
     endif
 endif
 endif
+
+CFLAGS_KASAN += $(call cc-option, -fno-sanitize-address-use-after-scope)
-- 
2.9.0


             reply	other threads:[~2016-11-22 22:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-22 22:54 Arnd Bergmann [this message]
2016-11-23  8:25 ` [PATCH] kasan: turn off -fsanitize-address-use-after-scope for now Andrey Ryabinin
2016-11-23  8:46   ` Arnd Bergmann
2016-11-23  9:33     ` Dmitry Vyukov
2016-11-23 18:49       ` Andrew Morton
2016-11-24 14:40         ` Dmitry Vyukov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161122225424.3739294-1-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=a.ryabinin@samsung.com \
    --cc=aryabinin@virtuozzo.com \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marxin@gcc.gnu.org \
    --cc=mmarek@suse.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox