* [RFC] powerpc: Enable UBSAN support
@ 2015-12-10 0:42 Daniel Axtens
2015-12-15 2:40 ` Andrew Donnellan
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Axtens @ 2015-12-10 0:42 UTC (permalink / raw)
To: linuxppc-dev; +Cc: mpe, linux-kernel, akpm, Daniel Axtens, Andrey Ryabinin
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.
CC: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
This to be applied on top of next with Andrey's patches:
1) https://patchwork.kernel.org/patch/7761341/
2) https://patchwork.kernel.org/patch/7761351/
3) https://patchwork.kernel.org/patch/7761361/
4) https://patchwork.kernel.org/patch/7785791/
This is RFC for a couple of reasons:
- I'd like the original patches to
s/ARCH_HAS_UBSAN_SANTIZE_ALL/ARCH_HAS_UBSAN_SAN*I*TIZE_ALL/
(I'm about to send an email about that)
- I've only tested on LE pseries so far - I want to test on powernv,
and on BE.
Signed-off-by: Daniel Axtens <dja@axtens.net>
---
arch/powerpc/Kconfig | 1 +
arch/powerpc/kernel/Makefile | 8 +++++++-
arch/powerpc/kernel/vdso32/Makefile | 1 +
arch/powerpc/kernel/vdso64/Makefile | 1 +
arch/powerpc/xmon/Makefile | 1 +
5 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 25283796a02e..e197de45d517 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -156,6 +156,7 @@ config PPC
select EDAC_ATOMIC_SCRUB
select ARCH_HAS_DMA_SET_COHERENT_MASK
select HAVE_ARCH_SECCOMP_FILTER
+ select ARCH_HAS_UBSAN_SANTIZE_ALL
config GENERIC_CSUM
def_bool CPU_LITTLE_ENDIAN
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index ba336930d448..794f22adf99d 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -136,12 +136,18 @@ endif
obj-$(CONFIG_EPAPR_PARAVIRT) += epapr_paravirt.o epapr_hcalls.o
obj-$(CONFIG_KVM_GUEST) += kvm.o kvm_emul.o
-# Disable GCOV in odd or sensitive code
+# Disable GCOV & sanitizers in odd or sensitive code
GCOV_PROFILE_prom_init.o := n
+UBSAN_SANITIZE_prom_init.o := n
GCOV_PROFILE_ftrace.o := n
+UBSAN_SANITIZE_ftrace.o := n
GCOV_PROFILE_machine_kexec_64.o := n
+UBSAN_SANITIZE_machine_kexec_64.o := n
GCOV_PROFILE_machine_kexec_32.o := n
+UBSAN_SANITIZE_machine_kexec_32.o := n
GCOV_PROFILE_kprobes.o := n
+UBSAN_SANITIZE_kprobes.o := n
+UBSAN_SANITIZE_vdso.o := n
extra-$(CONFIG_PPC_FPU) += fpu.o
extra-$(CONFIG_ALTIVEC) += vector.o
diff --git a/arch/powerpc/kernel/vdso32/Makefile b/arch/powerpc/kernel/vdso32/Makefile
index 6abffb7a8cd9..cbabd143acae 100644
--- a/arch/powerpc/kernel/vdso32/Makefile
+++ b/arch/powerpc/kernel/vdso32/Makefile
@@ -15,6 +15,7 @@ targets := $(obj-vdso32) vdso32.so vdso32.so.dbg
obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
GCOV_PROFILE := n
+UBSAN_SANITIZE := n
ccflags-y := -shared -fno-common -fno-builtin
ccflags-y += -nostdlib -Wl,-soname=linux-vdso32.so.1 \
diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile
index 8c8f2ae43935..c710802b8fb6 100644
--- a/arch/powerpc/kernel/vdso64/Makefile
+++ b/arch/powerpc/kernel/vdso64/Makefile
@@ -8,6 +8,7 @@ targets := $(obj-vdso64) vdso64.so vdso64.so.dbg
obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
GCOV_PROFILE := n
+UBSAN_SANITIZE := n
ccflags-y := -shared -fno-common -fno-builtin
ccflags-y += -nostdlib -Wl,-soname=linux-vdso64.so.1 \
diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile
index 1278788d96e3..436062dbb6e2 100644
--- a/arch/powerpc/xmon/Makefile
+++ b/arch/powerpc/xmon/Makefile
@@ -3,6 +3,7 @@
subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
GCOV_PROFILE := n
+UBSAN_SANITIZE := n
ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC)
--
2.6.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RFC] powerpc: Enable UBSAN support
2015-12-10 0:42 [RFC] powerpc: Enable UBSAN support Daniel Axtens
@ 2015-12-15 2:40 ` Andrew Donnellan
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Donnellan @ 2015-12-15 2:40 UTC (permalink / raw)
To: Daniel Axtens, linuxppc-dev; +Cc: akpm, Andrey Ryabinin, linux-kernel
On 10/12/15 11:42, Daniel Axtens wrote:
> 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.
>
> CC: Andrey Ryabinin <aryabinin@virtuozzo.com>
> ---
>
> This to be applied on top of next with Andrey's patches:
> 1) https://patchwork.kernel.org/patch/7761341/
> 2) https://patchwork.kernel.org/patch/7761351/
> 3) https://patchwork.kernel.org/patch/7761361/
> 4) https://patchwork.kernel.org/patch/7785791/
>
> This is RFC for a couple of reasons:
>
> - I'd like the original patches to
> s/ARCH_HAS_UBSAN_SANTIZE_ALL/ARCH_HAS_UBSAN_SAN*I*TIZE_ALL/
> (I'm about to send an email about that)
>
> - I've only tested on LE pseries so far - I want to test on powernv,
> and on BE.
>
> Signed-off-by: Daniel Axtens <dja@axtens.net>
I tested this patch as found in linux-next, along with the SANITIZE_ALL
typo fix, on a big-endian BML system, with gcc 5.2.1. It successfully
picked up one of the shift input issues that Daniel found, so therefore...
Tested-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
--
Andrew Donnellan Software Engineer, OzLabs
andrew.donnellan@au1.ibm.com Australia Development Lab, Canberra
+61 2 6201 8874 (work) IBM Australia Limited
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-12-15 2:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-10 0:42 [RFC] powerpc: Enable UBSAN support Daniel Axtens
2015-12-15 2:40 ` Andrew Donnellan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.