Re: UBSAN: Undefined behaviour in ./arch/arm/include/asm/bitops.h
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.
Re: UBSAN: Undefined behaviour in ./arch/arm/include/asm/bitops.h
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.
UBSAN: Undefined behaviour in ./arch/arm/include/asm/bitops.h
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: GW 4.8.0-rc7-00173-g142932f #25 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [] (unwind_backtrace) from [] (show_stack+0x20/0x24) [] (show_stack) from [] (dump_stack+0x84/0xa0) [] (dump_stack) from [] (ubsan_epilogue+0x14/0x50) [] (ubsan_epilogue) from [] (__ubsan_handle_negate_overflow+0x68/0x6c) [] (__ubsan_handle_negate_overflow) from [] (radix_tree_next_chunk+0x4e8/0x5ac) [] (radix_tree_next_chunk) from [] (find_get_pages_tag+0x1b0/0x390) [] (find_get_pages_tag) from [] (pagevec_lookup_tag+0x38/0x68) [] (pagevec_lookup_tag) from [] (write_cache_pages+0x134/0x85c) [] (write_cache_pages) from [] (generic_writepages+0x5c/0x9c) [] (generic_writepages) from [] (blkdev_writepages+0x18/0x1c) [] (blkdev_writepages) from [] (do_writepages+0x58/0xa4) [] (do_writepages) from [] (__filemap_fdatawrite_range+0xac/0x10c) [] (__filemap_fdatawrite_range) from [] (filemap_write_and_wait_range+0x54/0xb8) [] (filemap_write_and_wait_range) from [] (blkdev_fsync+0x40/0xa4) [] (blkdev_fsync) from [] (vfs_fsync_range+0x70/0x160) [] (vfs_fsync_range) from [] (do_fsync+0x4c/0x74) [] (do_fsync) from [] (SyS_fsync+0x1c/0x20) [] (SyS_fsync) from [] (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: GW 4.8.0-rc7-00173-g142932f #25 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [] (unwind_backtrace) from [] (show_stack+0x20/0x24) [] (show_stack) from [] (dump_stack+0x84/0xa0) [] (dump_stack) from [] (ubsan_epilogue+0x14/0x50) [] (ubsan_epilogue) from [] (__ubsan_handle_negate_overflow+0x68/0x6c) [] (__ubsan_handle_negate_overflow) from [] (next_signal+0x114/0x16c) [] (next_signal) from [] (dequeue_signal+0x30/0x30c) [] (dequeue_signal) from [] (get_signal+0x120/0xe84) [] (get_signal) from [] (do_signal+0x37c/0x550) [] (do_signal) from [] (do_work_pending+0xd0/0x134) [] (do_work_pending) from [] (slow_work_pending+0xc/0x20) Regards, - Seung-Woo Kim -- Seung-Woo Kim Samsung Software R Center --
UBSAN: Undefined behaviour in ./arch/arm/include/asm/bitops.h
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: GW 4.8.0-rc7-00173-g142932f #25 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [] (unwind_backtrace) from [] (show_stack+0x20/0x24) [] (show_stack) from [] (dump_stack+0x84/0xa0) [] (dump_stack) from [] (ubsan_epilogue+0x14/0x50) [] (ubsan_epilogue) from [] (__ubsan_handle_negate_overflow+0x68/0x6c) [] (__ubsan_handle_negate_overflow) from [] (radix_tree_next_chunk+0x4e8/0x5ac) [] (radix_tree_next_chunk) from [] (find_get_pages_tag+0x1b0/0x390) [] (find_get_pages_tag) from [] (pagevec_lookup_tag+0x38/0x68) [] (pagevec_lookup_tag) from [] (write_cache_pages+0x134/0x85c) [] (write_cache_pages) from [] (generic_writepages+0x5c/0x9c) [] (generic_writepages) from [] (blkdev_writepages+0x18/0x1c) [] (blkdev_writepages) from [] (do_writepages+0x58/0xa4) [] (do_writepages) from [] (__filemap_fdatawrite_range+0xac/0x10c) [] (__filemap_fdatawrite_range) from [] (filemap_write_and_wait_range+0x54/0xb8) [] (filemap_write_and_wait_range) from [] (blkdev_fsync+0x40/0xa4) [] (blkdev_fsync) from [] (vfs_fsync_range+0x70/0x160) [] (vfs_fsync_range) from [] (do_fsync+0x4c/0x74) [] (do_fsync) from [] (SyS_fsync+0x1c/0x20) [] (SyS_fsync) from [] (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: GW 4.8.0-rc7-00173-g142932f #25 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [] (unwind_backtrace) from [] (show_stack+0x20/0x24) [] (show_stack) from [] (dump_stack+0x84/0xa0) [] (dump_stack) from [] (ubsan_epilogue+0x14/0x50) [] (ubsan_epilogue) from [] (__ubsan_handle_negate_overflow+0x68/0x6c) [] (__ubsan_handle_negate_overflow) from [] (next_signal+0x114/0x16c) [] (next_signal) from [] (dequeue_signal+0x30/0x30c) [] (dequeue_signal) from [] (get_signal+0x120/0xe84) [] (get_signal) from [] (do_signal+0x37c/0x550) [] (do_signal) from [] (do_work_pending+0xd0/0x134) [] (do_work_pending) from [] (slow_work_pending+0xc/0x20) Regards, - Seung-Woo Kim -- Seung-Woo Kim Samsung Software R Center --