Skip to content

Commit bf76f73

Browse files
daxtenstorvalds
authored andcommitted
powerpc: enable UBSAN support
This hooks up UBSAN support for PowerPC. So far it's found some interesting cases where we don't properly sanitise input to shifts, including one in our futex handling. Nothing critical, but interesting and worth fixing. [valentinrothberg@gmail.com: arch/powerpc/Kconfig: fix typo in select statement] Signed-off-by: Daniel Axtens <dja@axtens.net> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Tested-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Acked-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent c6d3085 commit bf76f73

5 files changed

Lines changed: 11 additions & 1 deletion

File tree

‎arch/powerpc/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ config PPC
158158
select ARCH_HAS_DMA_SET_COHERENT_MASK
159159
select ARCH_HAS_DEVMEM_IS_ALLOWED
160160
select HAVE_ARCH_SECCOMP_FILTER
161+
select ARCH_HAS_UBSAN_SANITIZE_ALL
161162

162163
config GENERIC_CSUM
163164
def_bool CPU_LITTLE_ENDIAN

‎arch/powerpc/kernel/Makefile‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,18 @@ endif
136136
obj-$(CONFIG_EPAPR_PARAVIRT) += epapr_paravirt.o epapr_hcalls.o
137137
obj-$(CONFIG_KVM_GUEST) += kvm.o kvm_emul.o
138138

139-
# Disable GCOV in odd or sensitive code
139+
# Disable GCOV & sanitizers in odd or sensitive code
140140
GCOV_PROFILE_prom_init.o := n
141+
UBSAN_SANITIZE_prom_init.o := n
141142
GCOV_PROFILE_ftrace.o := n
143+
UBSAN_SANITIZE_ftrace.o := n
142144
GCOV_PROFILE_machine_kexec_64.o := n
145+
UBSAN_SANITIZE_machine_kexec_64.o := n
143146
GCOV_PROFILE_machine_kexec_32.o := n
147+
UBSAN_SANITIZE_machine_kexec_32.o := n
144148
GCOV_PROFILE_kprobes.o := n
149+
UBSAN_SANITIZE_kprobes.o := n
150+
UBSAN_SANITIZE_vdso.o := n
145151

146152
extra-$(CONFIG_PPC_FPU) += fpu.o
147153
extra-$(CONFIG_ALTIVEC) += vector.o

‎arch/powerpc/kernel/vdso32/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ targets := $(obj-vdso32) vdso32.so vdso32.so.dbg
1515
obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
1616

1717
GCOV_PROFILE := n
18+
UBSAN_SANITIZE := n
1819

1920
ccflags-y := -shared -fno-common -fno-builtin
2021
ccflags-y += -nostdlib -Wl,-soname=linux-vdso32.so.1 \

‎arch/powerpc/kernel/vdso64/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ targets := $(obj-vdso64) vdso64.so vdso64.so.dbg
88
obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
99

1010
GCOV_PROFILE := n
11+
UBSAN_SANITIZE := n
1112

1213
ccflags-y := -shared -fno-common -fno-builtin
1314
ccflags-y += -nostdlib -Wl,-soname=linux-vdso64.so.1 \

‎arch/powerpc/xmon/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
44

55
GCOV_PROFILE := n
6+
UBSAN_SANITIZE := n
67

78
ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC)
89

0 commit comments

Comments
 (0)