* [PATCH] arm: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL @ 2016-09-22 4:49 ` Seung-Woo Kim 2016-09-24 4:45 ` UBSAN: Undefined behaviour in ./arch/arm/include/asm/bitops.h Seung-Woo Kim 0 siblings, 1 reply; 3+ messages in thread From: Seung-Woo Kim @ 2016-09-22 4:49 UTC (permalink / raw) To: linux, linux-arm-kernel, linux-kernel; +Cc: aryabinin, arnd, sw0312.kim 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. Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> --- This is resend of the patch I already sent, [1], without RFC tag. [1] https://patchwork.kernel.org/patch/9189533/ I tested kernel build and basic boot up on Exynos5422, Exynos4412 and Exynos3250 SoC boards. At previous time on [1], there were some build error on other systems, but they were caused by driver bug or gcc bug. So I think UBSAN on ARM can be re-considered. --- arch/arm/Kconfig | 1 + arch/arm/boot/compressed/Makefile | 1 + arch/arm/vdso/Makefile | 1 + 3 files changed, 3 insertions(+), 0 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index a9c4e48..a80f9b1 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -7,6 +7,7 @@ config ARM select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAVE_CUSTOM_GPIO_H select ARCH_HAS_GCOV_PROFILE_ALL + select ARCH_HAS_UBSAN_SANITIZE_ALL select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_SUPPORTS_ATOMIC_RMW select ARCH_USE_BUILTIN_BSWAP diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index d50430c..883374f 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -23,6 +23,7 @@ OBJS += hyp-stub.o endif GCOV_PROFILE := n +UBSAN_SANITIZE := n # # Architecture dependencies diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile index 59a8fa7..cb90e59 100644 --- a/arch/arm/vdso/Makefile +++ b/arch/arm/vdso/Makefile @@ -28,6 +28,7 @@ CFLAGS_vgettimeofday.o = -O2 # Disable gcov profiling for VDSO code GCOV_PROFILE := n +UBSAN_SANITIZE := n # Force dependency $(obj)/vdso.o : $(obj)/vdso.so -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* UBSAN: Undefined behaviour in ./arch/arm/include/asm/bitops.h 2016-09-22 4:49 ` [PATCH] arm: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL Seung-Woo Kim @ 2016-09-24 4:45 ` Seung-Woo Kim 2016-09-24 9:15 ` Russell King - ARM Linux 0 siblings, 1 reply; 3+ messages in thread From: Seung-Woo Kim @ 2016-09-24 4:45 UTC (permalink / raw) To: Seung-Woo Kim; +Cc: linux, linux-arm-kernel, linux-kernel, aryabinin, arnd With the patch "arm: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL", I got following UBSAN warning on Exynos5422 SoC board. ================================================================================ UBSAN: Undefined behaviour in ./arch/arm/include/asm/bitops.h:296:17 negation of -2147483648 cannot be represented in type 'int': CPU: 2 PID: 5637 Comm: fsck.ext4 Tainted: G W 4.8.0-rc7-00173-g142932f #25 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [<c0119e28>] (unwind_backtrace) from [<c01123dc>] (show_stack+0x20/0x24) [<c01123dc>] (show_stack) from [<c0617f70>] (dump_stack+0x84/0xa0) [<c0617f70>] (dump_stack) from [<c0672ba0>] (ubsan_epilogue+0x14/0x50) [<c0672ba0>] (ubsan_epilogue) from [<c067335c>] (__ubsan_handle_negate_overflow+0x68/0x6c) [<c067335c>] (__ubsan_handle_negate_overflow) from [<c0621044>] (radix_tree_next_chunk+0x4e8/0x5ac) [<c0621044>] (radix_tree_next_chunk) from [<c0286abc>] (find_get_pages_tag+0x1b0/0x390) [<c0286abc>] (find_get_pages_tag) from [<c02a6154>] (pagevec_lookup_tag+0x38/0x68) [<c02a6154>] (pagevec_lookup_tag) from [<c029e818>] (write_cache_pages+0x134/0x85c) [<c029e818>] (write_cache_pages) from [<c029ef9c>] (generic_writepages+0x5c/0x9c) [<c029ef9c>] (generic_writepages) from [<c038eae8>] (blkdev_writepages+0x18/0x1c) [<c038eae8>] (blkdev_writepages) from [<c02a2054>] (do_writepages+0x58/0xa4) [<c02a2054>] (do_writepages) from [<c0289abc>] (__filemap_fdatawrite_range+0xac/0x10c) [<c0289abc>] (__filemap_fdatawrite_range) from [<c0289cc8>] (filemap_write_and_wait_range+0x54/0xb8) [<c0289cc8>] (filemap_write_and_wait_range) from [<c038f75c>] (blkdev_fsync+0x40/0xa4) [<c038f75c>] (blkdev_fsync) from [<c0381bf0>] (vfs_fsync_range+0x70/0x160) [<c0381bf0>] (vfs_fsync_range) from [<c0381d68>] (do_fsync+0x4c/0x74) [<c0381d68>] (do_fsync) from [<c038224c>] (SyS_fsync+0x1c/0x20) [<c038224c>] (SyS_fsync) from [<c010bd20>] (ret_fast_syscall+0x0/0x3c) ================================================================================ ================================================================================ UBSAN: Undefined behaviour in ./arch/arm/include/asm/bitops.h:296:17 negation of -2147483648 cannot be represented in type 'int': CPU: 3 PID: 6313 Comm: enlightenment Tainted: G W 4.8.0-rc7-00173-g142932f #25 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [<c0119e28>] (unwind_backtrace) from [<c01123dc>] (show_stack+0x20/0x24) [<c01123dc>] (show_stack) from [<c0617f10>] (dump_stack+0x84/0xa0) [<c0617f10>] (dump_stack) from [<c0672b40>] (ubsan_epilogue+0x14/0x50) [<c0672b40>] (ubsan_epilogue) from [<c06732fc>] (__ubsan_handle_negate_overflow+0x68/0x6c) [<c06732fc>] (__ubsan_handle_negate_overflow) from [<c0147f54>] (next_signal+0x114/0x16c) [<c0147f54>] (next_signal) from [<c0147fdc>] (dequeue_signal+0x30/0x30c) [<c0147fdc>] (dequeue_signal) from [<c014cb58>] (get_signal+0x120/0xe84) [<c014cb58>] (get_signal) from [<c01114fc>] (do_signal+0x37c/0x550) [<c01114fc>] (do_signal) from [<c01119b8>] (do_work_pending+0xd0/0x134) [<c01119b8>] (do_work_pending) from [<c010bd74>] (slow_work_pending+0xc/0x20) ================================================================================ Regards, - Seung-Woo Kim -- Seung-Woo Kim Samsung Software R&D Center -- ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: UBSAN: Undefined behaviour in ./arch/arm/include/asm/bitops.h 2016-09-24 4:45 ` UBSAN: Undefined behaviour in ./arch/arm/include/asm/bitops.h Seung-Woo Kim @ 2016-09-24 9:15 ` Russell King - ARM Linux 0 siblings, 0 replies; 3+ messages in thread From: Russell King - ARM Linux @ 2016-09-24 9:15 UTC (permalink / raw) To: Seung-Woo Kim; +Cc: linux-arm-kernel, linux-kernel, aryabinin, arnd On Sat, Sep 24, 2016 at 01:45:33PM +0900, Seung-Woo Kim wrote: > With the patch "arm: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL", I got > following UBSAN warning on Exynos5422 SoC board. Well, the simple solution is to have fls() and ffs() take unsigned int arguments rather than ints - but the question that brings up is: why do both of these take signed ints? It seems at least to me that it would be more sensible for these to take unsigned int, or even unsigned long like the other bitops do. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-24 9:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20160922045043epcas1p2e275276a65b244a5a013842597fcc0f1@epcas1p2.samsung.com>
2016-09-22 4:49 ` [PATCH] arm: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL Seung-Woo Kim
2016-09-24 4:45 ` UBSAN: Undefined behaviour in ./arch/arm/include/asm/bitops.h Seung-Woo Kim
2016-09-24 9:15 ` Russell King - ARM Linux
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox