s390: enable UBSAN
authorChristian Borntraeger <borntraeger@de.ibm.com>
Mon, 12 Sep 2016 12:37:20 +0000 (14:37 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 20 Sep 2016 12:26:23 +0000 (14:26 +0200)
This enables UBSAN for s390. We have to disable the null sanitizer
as s390 code does access memory via a null pointer (the prefix page).

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/Kconfig
arch/s390/boot/compressed/Makefile
arch/s390/kernel/Makefile
arch/s390/kernel/vdso32/Makefile
arch/s390/kernel/vdso64/Makefile

index f4989fb4ac8df82bd3fb56029795fc06c899679c..608f4eabb2de954b9adcd332c918e789f64b3ff8 100644 (file)
@@ -74,6 +74,7 @@ config S390
        select ARCH_HAS_GCOV_PROFILE_ALL
        select ARCH_HAS_KCOV
        select ARCH_HAS_SG_CHAIN
+       select ARCH_HAS_UBSAN_SANITIZE_ALL
        select ARCH_HAVE_NMI_SAFE_CMPXCHG
        select ARCH_INLINE_READ_LOCK
        select ARCH_INLINE_READ_LOCK_BH
@@ -110,6 +111,7 @@ config S390
        select ARCH_USE_CMPXCHG_LOCKREF
        select ARCH_WANTS_DYNAMIC_TASK_STRUCT
        select ARCH_WANTS_PROT_NUMA_PROT_NONE
+       select ARCH_WANTS_UBSAN_NO_NULL
        select ARCH_WANT_IPC_PARSE_VERSION
        select BUILDTIME_EXTABLE_SORT
        select CLONE_BACKWARDS2
index 33ba697c782d6c73af113d4dda58f0fd26984e91..0daa070d6c9dbb58767e931530ad0f9d023ca683 100644 (file)
@@ -17,6 +17,7 @@ KBUILD_CFLAGS += $(call cc-option,-mpacked-stack)
 KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
 
 GCOV_PROFILE := n
+UBSAN_SANITIZE := n
 
 OBJECTS := $(addprefix $(objtree)/arch/s390/kernel/, head.o sclp.o ebcdic.o als.o)
 OBJECTS += $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o
index 3234817c7d471eedcda165a0b69269c7c11da91d..72ccc41444dc64a1ddef531fd635ddf24bbbc6be 100644 (file)
@@ -48,6 +48,9 @@ AFLAGS_head.o         += -march=z900
 endif
 GCOV_PROFILE_sclp.o := n
 GCOV_PROFILE_als.o := n
+UBSAN_SANITIZE_als.o := n
+UBSAN_SANITIZE_early.o := n
+UBSAN_SANITIZE_sclp.o := n
 
 obj-y  := traps.o time.o process.o base.o early.o setup.o idle.o vtime.o
 obj-y  += processor.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o nmi.o
index 68145456fee2320e89195df454df32f89a27a0d7..6cc947896c77e48dbcf4a76ce21563ceff381383 100644 (file)
@@ -24,8 +24,9 @@ obj-y += vdso32_wrapper.o
 extra-y += vdso32.lds
 CPPFLAGS_vdso32.lds += -P -C -U$(ARCH)
 
-# Disable gcov profiling for VDSO code
+# Disable gcov profiling and ubsan for VDSO code
 GCOV_PROFILE := n
+UBSAN_SANITIZE := n
 
 # Force dependency (incbin is bad)
 $(obj)/vdso32_wrapper.o : $(obj)/vdso32.so
index 0b0fd22c869a0db5da6cd0763d43ff6b7c699df8..2d54c18089eb6531778c9421ddbfa7e014d94c09 100644 (file)
@@ -24,8 +24,9 @@ obj-y += vdso64_wrapper.o
 extra-y += vdso64.lds
 CPPFLAGS_vdso64.lds += -P -C -U$(ARCH)
 
-# Disable gcov profiling for VDSO code
+# Disable gcov profiling and ubsan for VDSO code
 GCOV_PROFILE := n
+UBSAN_SANITIZE := n
 
 # Force dependency (incbin is bad)
 $(obj)/vdso64_wrapper.o : $(obj)/vdso64.so