ARM: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL
PATCH 1/1 ARM: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL
From: Seung-Woo Kim <[email protected]>
To enable UBSAN on ARM, this patch enables ARCH_HAS_UBSAN_SANITIZE_ALL from arm confiuration. Basic kernel bootup test is passed on arm with CONFIG_UBSAN_SANITIZE_ALL enabled.
--- arch/arm/Kconfig | 1 + arch/arm/boot/compressed/Makefile | 1 + arch/arm/vdso/Makefile | 1 + 3 files changed, 3 insertions(+)
arch/arm/Kconfig +1 -0
@@ -27,6 +27,7 @@ config ARM select ARCH_HAVE_NMI_SAFE_CMPXCHG if CPU_V7 || CPU_V7M || CPU_V6K select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_KEEP_MEMBLOCK + select ARCH_HAS_UBSAN_SANITIZE_ALL select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_NO_SG_CHAIN if !ARM_HAS_SG_CHAIN select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
arch/arm/boot/compressed/Makefile +1 -0
@@ -27,6 +27,7 @@ KASAN_SANITIZE := n # Prevents link failures: __sanitizer_cov_trace_pc() is not linked in. KCOV_INSTRUMENT := n +UBSAN_SANITIZE := n # # Architecture dependencies
arch/arm/vdso/Makefile +1 -0
@@ -37,6 +37,7 @@ endif # Disable gcov profiling for VDSO code GCOV_PROFILE := n +UBSAN_SANITIZE := n # Prevents link failures: __sanitizer_cov_trace_pc() is not linked in. KCOV_INSTRUMENT := n
Signature · 1 line
2.25.1
Quoted 9 lines · Florian Fainelli
From: Seung-Woo Kim <[email protected]>
To enable UBSAN on ARM, this patch enables
ARCH_HAS_UBSAN_SANITIZE_ALLfrom arm confiuration. Basic kernel bootup test is passed on arm withCONFIG_UBSAN_SANITIZE_ALLenabled.Signed-off-by Seung-Woo Kim <[email protected]>[florian: rebased against v6.0-rc7]Signed-off-by Florian Fainelli <[email protected]>
Ah-ha, thanks for testing this. What devices did you check this on? I know boot-up on arm32 can be very device-specific.
Which UBSAN configs did you try?
Thanks!
-Kees
Signature · 1 line
Kees Cook
Quoted 7 lines · Kees Cook
Quoted 6 lines · Florian Fainelli
From: Seung-Woo Kim <[email protected]>
To enable UBSAN on ARM, this patch enables
ARCH_HAS_UBSAN_SANITIZE_ALLfrom arm confiuration. Basic kernel bootup test is passed on arm withCONFIG_UBSAN_SANITIZE_ALLenabled.
Quoted 6 lines
Quoted 3 lines
Signed-off-by Seung-Woo Kim <[email protected]>[florian: rebased against v6.0-rc7]Signed-off-by Florian Fainelli <[email protected]>Ah-ha, thanks for testing this. What devices did you check this on? I know boot-up on arm32 can be very device-specific.
This was tested on an ARCH_BRCMSTB system which is using an ARMv8 CPU booted in AArch32 mode, so virtually equivalent to armv7l. A raspberry Pi 4B is also happily booting with it.
Quoted 2 lines
Which UBSAN configs did you try?
All CONFIG_UBSAN_* work with the exception of CONFIG_UBSAN_ALIGNMENT on my ARCH_BRCMSTB system, however it works fine on the Raspberry Pi 4B. Florian
William Zhang
Tested-byQuoted 15 lines · Florian Fainelli
Quoted 7 lines · Kees Cook
Quoted 6 lines · Florian Fainelli
From: Seung-Woo Kim <[email protected]>
To enable UBSAN on ARM, this patch enables
ARCH_HAS_UBSAN_SANITIZE_ALLfrom arm confiuration. Basic kernel bootup test is passed on arm withCONFIG_UBSAN_SANITIZE_ALLenabled.Quoted 6 lines
Quoted 3 lines
Signed-off-by Seung-Woo Kim <[email protected]>[florian: rebased against v6.0-rc7]Signed-off-by Florian Fainelli <[email protected]>Ah-ha, thanks for testing this. What devices did you check this on? I know boot-up on arm32 can be very device-specific.
Quoted 7 lines
This was tested on an
ARCH_BRCMSTBsystem which is using an ARMv8 CPU booted in AArch32 mode, so virtually equivalent to armv7l. A raspberry Pi 4B is also happily booting with it.Quoted 2 lines
Which UBSAN configs did you try?
All CONFIG_UBSAN_* work with the exception of
CONFIG_UBSAN_ALIGNMENTon myARCH_BRCMSTBsystem, however it works fine on the Raspberry Pi 4B. Florian
I also tested on a BCM63138 board (ARM A9) under ARCH_BCMBCA using the multi_v7_defconfig with all the UBSAN configs enabled except UBSAN_ALIGNMENT and board boots up fine. Turning on UBSAN_ALIGNMENT results in flood of false positive misaligned-access warnings. This is fine as ARM supports unaligned access.
It did catch an out-of-band bug in mach-sunxi smp code. I will submit a separate patch to fix that bug.
Quoted 29 lines · William Zhang
Quoted 20 lines · Florian Fainelli
Quoted 7 lines · Kees Cook
Quoted 6 lines · Florian Fainelli
From: Seung-Woo Kim <[email protected]>
To enable UBSAN on ARM, this patch enables
ARCH_HAS_UBSAN_SANITIZE_ALLfrom arm confiuration. Basic kernel bootup test is passed on arm withCONFIG_UBSAN_SANITIZE_ALLenabled.Quoted 6 lines
Quoted 3 lines
Signed-off-by Seung-Woo Kim <[email protected]>[florian: rebased against v6.0-rc7]Signed-off-by Florian Fainelli <[email protected]>Ah-ha, thanks for testing this. What devices did you check this on? I know boot-up on arm32 can be very device-specific.
This was tested on an
ARCH_BRCMSTBsystem which is using an ARMv8 CPU booted in AArch32 mode, so virtually equivalent to armv7l. A raspberry Pi 4B is also happily booting with it.Quoted 1 line
Quoted 5 lines
Quoted 1 line
Which UBSAN configs did you try?
All CONFIG_UBSAN_* work with the exception of
CONFIG_UBSAN_ALIGNMENTon myARCH_BRCMSTBsystem, however it works fine on the Raspberry Pi 4B. Florian
Quoted 8 lines
I also tested on a BCM63138 board (ARM A9) under
ARCH_BCMBCAusing themulti_v7_defconfigwith all the UBSAN configs enabled exceptUBSAN_ALIGNMENTand board boots up fine. Turning onUBSAN_ALIGNMENTresults in flood of false positive misaligned-access warnings. This is fine as ARM supports unaligned access.It did catch an out-of-band bug in mach-sunxi smp code. I will submit a separate patch to fix that bug.
Yay! :) Move coverage is great. :)
Quoted 2 lines
Tested-by William Zhang <[email protected]>
Thanks!
Signature · 1 line
Kees Cook
Quoted 36 lines · Kees Cook
Quoted 35 lines · William Zhang
Quoted 20 lines · Florian Fainelli
Quoted 7 lines · Kees Cook
Quoted 6 lines · Florian Fainelli
From: Seung-Woo Kim <[email protected]>
To enable UBSAN on ARM, this patch enables
ARCH_HAS_UBSAN_SANITIZE_ALLfrom arm confiuration. Basic kernel bootup test is passed on arm withCONFIG_UBSAN_SANITIZE_ALLenabled.Quoted 6 lines
Quoted 3 lines
Signed-off-by Seung-Woo Kim <[email protected]>[florian: rebased against v6.0-rc7]Signed-off-by Florian Fainelli <[email protected]>Ah-ha, thanks for testing this. What devices did you check this on? I know boot-up on arm32 can be very device-specific.
This was tested on an
ARCH_BRCMSTBsystem which is using an ARMv8 CPU booted in AArch32 mode, so virtually equivalent to armv7l. A raspberry Pi 4B is also happily booting with it.Quoted 1 line
Quoted 5 lines
Quoted 1 line
Which UBSAN configs did you try?
All CONFIG_UBSAN_* work with the exception of
CONFIG_UBSAN_ALIGNMENTon myARCH_BRCMSTBsystem, however it works fine on the Raspberry Pi 4B. FlorianI also tested on a BCM63138 board (ARM A9) under
ARCH_BCMBCAusing themulti_v7_defconfigwith all the UBSAN configs enabled exceptUBSAN_ALIGNMENTand board boots up fine. Turning onUBSAN_ALIGNMENTresults in flood of false positive misaligned-access warnings. This is fine as ARM supports unaligned access.
Quoted 7 lines
Quoted 2 lines
It did catch an out-of-band bug in mach-sunxi smp code. I will submit a separate patch to fix that bug.
Yay! :) Move coverage is great. :)
Quoted 2 lines
Tested-by William Zhang <[email protected]>
Submitted to the patch tracker:
https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=9253/1
Signature · 1 line
Florian
Quoted 9 lines · Florian Fainelli
From: Seung-Woo Kim <[email protected]>
To enable UBSAN on ARM, this patch enables
ARCH_HAS_UBSAN_SANITIZE_ALLfrom arm confiuration. Basic kernel bootup test is passed on arm withCONFIG_UBSAN_SANITIZE_ALLenabled.Signed-off-by Seung-Woo Kim <[email protected]>[florian: rebased against v6.0-rc7]Signed-off-by Florian Fainelli <[email protected]>
Pretty cool that it "just works", I was thinking to myself that I should try this one
day. Sorry I was late to look at the patch.
Have you also looked at KCSAN?
Yours,
Linus Walleij
Quoted 12 lines · Linus Walleij
Quoted 9 lines · Florian Fainelli
From: Seung-Woo Kim <[email protected]>
To enable UBSAN on ARM, this patch enables
ARCH_HAS_UBSAN_SANITIZE_ALLfrom arm confiuration. Basic kernel bootup test is passed on arm withCONFIG_UBSAN_SANITIZE_ALLenabled.Signed-off-by Seung-Woo Kim <[email protected]>[florian: rebased against v6.0-rc7]Signed-off-by Florian Fainelli <[email protected]>
Quoted 5 lines
Pretty cool that it "just works", I was thinking to myself that I should try this one
day. Sorry I was late to look at the patch.Have you also looked at KCSAN?
Not yet, that would be next. Most often, at least for ARCH_BRCMSTB the same hardware and set of drivers run on ARM64 which is typically much more feature full, so we get coverage on *SAN features that way. --
Florian