MIPS: Enable Undefined Behavior Sanitizer UBSAN
authorHassan Naveed <hnaveed@wavecomp.com>
Tue, 20 Nov 2018 00:49:37 +0000 (16:49 -0800)
committerPaul Burton <paul.burton@mips.com>
Tue, 20 Nov 2018 20:23:06 +0000 (12:23 -0800)
Select ARCH_HAS_UBSAN_SANITIZE_ALL in order to allow the user to
enable CONFIG_UBSAN_SANITIZE_ALL and instrument the entire kernel for
ubsan checks.
We exclude the VDSO from this because its build doesn't include the
__ubsan_handle_*() functions that the kernel proper defines in from
lib/ubsan.c, and the VDSO would have no sane way to report errors even
if it had definitions of these functions.

Signed-off-by: Hassan Naveed <hnaveed@wavecomp.com>
Reviewed-by: Paul Burton <paul.burton@mips.com>
Signed-off-by: Paul Burton <paul.burton@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/21179/
Cc: <linux-mips@linux-mips.org>
arch/mips/Kconfig
arch/mips/vdso/Makefile

index 7594308ab99d764c95c61461172632ce088cc614..e83a8cce41e98b5429c9d0f7f44cb4f622b3fbbd 100644 (file)
@@ -7,6 +7,7 @@ config MIPS
        select ARCH_DISCARD_MEMBLOCK
        select ARCH_HAS_ELF_RANDOMIZE
        select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
+       select ARCH_HAS_UBSAN_SANITIZE_ALL
        select ARCH_SUPPORTS_UPROBES
        select ARCH_USE_BUILTIN_BSWAP
        select ARCH_USE_CMPXCHG_LOCKREF if 64BIT
index 58a0315ad743d5bcf965814fd17431f3f2f2bf03..f6fd340e39c2f4bae451f0ecdab0bd929a041eef 100644 (file)
@@ -50,6 +50,7 @@ VDSO_LDFLAGS := \
        $(call cc-ldoption, -Wl$(comma)--build-id)
 
 GCOV_PROFILE := n
+UBSAN_SANITIZE := n
 
 #
 # Shared build commands.