[PATCH] kasan: turn off -fsanitize-address-use-after-scope for now

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

 



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@xxxxxxxxxxx>
Cc: Andrey Ryabinin <a.ryabinin@xxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux