Upon loading zram with /etc/init.d/zram-init start I got the following in my kernel log: Jan 8 16:48:26 satyr kernel: ================================================================================ Jan 8 16:48:26 satyr kernel: UBSAN: Undefined behaviour in ./include/uapi/linux/byteorder/little_endian.h:58:9 Jan 8 16:48:26 satyr kernel: load of misaligned address 000000000124f2d5 for type 'const __le32' Jan 8 16:48:26 satyr kernel: which requires 4 byte alignment Jan 8 16:48:26 satyr kernel: CPU: 6 PID: 7414 Comm: mkswap Tainted: P O T 4.19.8-gentoo #1 Jan 8 16:48:26 satyr kernel: Hardware name: ASUSTeK COMPUTER INC. G752VY/G752VY, BIOS G752VY.304 06/29/2017 Jan 8 16:48:26 satyr kernel: Call Trace: Jan 8 16:48:26 satyr kernel: dump_stack+0xa1/0x11b Jan 8 16:48:26 satyr kernel: ubsan_epilogue+0x9/0x40 Jan 8 16:48:26 satyr kernel: ubsan_type_mismatch_common+0x17b/0x190 Jan 8 16:48:26 satyr kernel: __ubsan_handle_type_mismatch+0x43/0x60 Jan 8 16:48:26 satyr kernel: LZ4_compress_default+0x2b8a/0x3b20 [lz4_compress] Jan 8 16:48:26 satyr kernel: lz4_compress_crypto+0x36/0xb0 [lz4] Jan 8 16:48:26 satyr kernel: zram_bvec_rw.isra.11+0x438/0x1770 [zram] Jan 8 16:48:26 satyr kernel: zram_make_request+0x25b/0x7c9 [zram] Jan 8 16:48:26 satyr kernel: generic_make_request+0x301/0xa30 Jan 8 16:48:26 satyr kernel: ? submit_bio+0x3d/0x390 Jan 8 16:48:26 satyr kernel: submit_bio+0x3d/0x390 Jan 8 16:48:26 satyr kernel: ? guard_bio_eod+0x69/0x450 Jan 8 16:48:26 satyr kernel: submit_bh_wbc+0x2a6/0x600 Jan 8 16:48:26 satyr kernel: __block_write_full_page+0x2b3/0xb80 Jan 8 16:48:26 satyr kernel: ? block_llseek+0xa0/0xa0 Jan 8 16:48:26 satyr kernel: ? clear_page_dirty_for_io+0x402/0x850 Jan 8 16:48:26 satyr kernel: __writepage+0x31/0x90 Jan 8 16:48:26 satyr kernel: write_cache_pages+0x2c5/0xa80 Jan 8 16:48:26 satyr kernel: ? __wb_calc_thresh+0x310/0x310 Jan 8 16:48:26 satyr kernel: generic_writepages+0x77/0xe0 Jan 8 16:48:26 satyr kernel: ? blkdev_writepage+0x10/0x10 Jan 8 16:48:26 satyr kernel: ? do_writepages+0x7e/0x120 Jan 8 16:48:26 satyr kernel: do_writepages+0x7e/0x120 Jan 8 16:48:26 satyr kernel: __filemap_fdatawrite_range+0x10e/0x1e0 Jan 8 16:48:26 satyr kernel: file_write_and_wait_range+0x48/0xb0 Jan 8 16:48:26 satyr kernel: blkdev_fsync+0x2e/0x90 Jan 8 16:48:26 satyr kernel: do_fsync+0x33/0x60 Jan 8 16:48:26 satyr kernel: __x64_sys_fsync+0x14/0x30 Jan 8 16:48:26 satyr kernel: do_syscall_64+0x85/0x280 Jan 8 16:48:26 satyr kernel: entry_SYSCALL_64_after_hwframe+0x49/0xbe Jan 8 16:48:26 satyr kernel: RIP: 0033:0x7f2b12b39108 Jan 8 16:48:26 satyr kernel: Code: 00 00 48 83 ec 28 64 48 8b 04 25 28 00 00 00 48 89 44 24 18 31 c0 48 8d 05 1d c7 2c 00 8b 00 85 c0 75 27 b8 4a 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 50 48 8b 74 24 18 64 48 33 34 25 28 00 00 00 Jan 8 16:48:26 satyr kernel: RSP: 002b:00007ffc5a0dcdd0 EFLAGS: 00000246 ORIG_RAX: 000000000000004a Jan 8 16:48:26 satyr kernel: RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f2b12b39108 Jan 8 16:48:26 satyr kernel: RDX: 00007f2b12e00b00 RSI: 0000000000000000 RDI: 0000000000000003 Jan 8 16:48:26 satyr kernel: RBP: 0000000000000000 R08: 0000000000000024 R09: 00007ffc5a0dcf00 Jan 8 16:48:26 satyr kernel: R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffc5a0dcf00 Jan 8 16:48:26 satyr kernel: R13: 000055580a786137 R14: 00000000000061b0 R15: 0000000000000000 Jan 8 16:48:26 satyr kernel: ================================================================================ Some info: Portage 2.3.51 (python 3.6.5-final-0, hardened/linux/amd64, gcc-7.3.0, glibc-2.27-r6, 4.19.8-gentoo x86_64) ================================================================= System uname: Linux-4.19.8-gentoo-x86_64-Intel-R-_Core-TM-_i7-6700HQ_CPU_@_2.60GHz-with-gentoo-2.6 KiB Mem: 40976340 total, 16220132 free KiB Swap: 0 total, 0 free Timestamp of repository gentoo: Thu, 13 Dec 2018 12:15:01 +0000 Head commit of repository gentoo: 057645ffcdb86bd24e7c965f6e1aa03db33abb4c sh bash 4.4_p12 ld GNU ld (Gentoo 2.30 p5) 2.30.0 app-shells/bash: 4.4_p12::gentoo dev-java/java-config: 2.2.0-r4::gentoo dev-lang/perl: 5.26.2::gentoo dev-lang/python: 2.7.15::gentoo, 3.4.8::gentoo, 3.5.5::gentoo, 3.6.5::gentoo dev-util/cmake: 3.12.3::gentoo dev-util/pkgconfig: 0.29.2::gentoo sys-apps/baselayout: 2.6-r1::gentoo sys-apps/openrc: 0.38.3-r1::gentoo sys-apps/sandbox: 2.13::gentoo sys-devel/autoconf: 2.13::gentoo, 2.69-r4::gentoo sys-devel/automake: 1.11.6-r3::gentoo, 1.12.6::gentoo, 1.13.4-r2::gentoo, 1.14.1::gentoo, 1.15.1-r2::gentoo sys-devel/binutils: 2.30-r4::gentoo sys-devel/gcc: 7.3.0-r3::gentoo sys-devel/gcc-config: 1.8-r1::gentoo sys-devel/libtool: 2.4.6-r3::gentoo sys-devel/make: 4.2.1-r4::gentoo sys-kernel/linux-headers: 4.13::gentoo (virtual/os-headers) sys-libs/glibc: 2.27-r6::gentoo I have quite a few of 'undefined behaviour' messages in my kernel.log, all about kernel 4.18.9 (a huge number of them hits me when I boot and the initramfs is being extracted, for example) - shall I report them here?
There is another UBSAN message for the same header, regarding line 66: kernel: ================================================================================ kernel: UBSAN: Undefined behaviour in ./include/uapi/linux/byteorder/little_endian.h:66:9 kernel: load of misaligned address 00000000f7138def for type 'const __le16' kernel: which requires 2 byte alignment kernel: CPU: 6 PID: 7414 Comm: mkswap Tainted: P O T 4.19.8-gentoo #1 kernel: Hardware name: ASUSTeK COMPUTER INC. G752VY/G752VY, BIOS G752VY.304 06/29/2017 kernel: Call Trace: kernel: dump_stack+0xa1/0x11b kernel: ubsan_epilogue+0x9/0x40 kernel: ubsan_type_mismatch_common+0x17b/0x190 kernel: __ubsan_handle_type_mismatch+0x43/0x60 kernel: LZ4_compress_default+0x3227/0x3b20 [lz4_compress] kernel: lz4_compress_crypto+0x36/0xb0 [lz4] kernel: zram_bvec_rw.isra.11+0x438/0x1770 [zram] kernel: zram_make_request+0x25b/0x7c9 [zram] kernel: generic_make_request+0x301/0xa30 kernel: ? submit_bio+0x3d/0x390 kernel: submit_bio+0x3d/0x390 kernel: ? guard_bio_eod+0x69/0x450 kernel: submit_bh_wbc+0x2a6/0x600 kernel: __block_write_full_page+0x2b3/0xb80 kernel: ? block_llseek+0xa0/0xa0 kernel: ? clear_page_dirty_for_io+0x402/0x850 kernel: __writepage+0x31/0x90 kernel: write_cache_pages+0x2c5/0xa80 kernel: ? __wb_calc_thresh+0x310/0x310 kernel: generic_writepages+0x77/0xe0 kernel: ? blkdev_writepage+0x10/0x10 kernel: ? do_writepages+0x7e/0x120 kernel: do_writepages+0x7e/0x120 kernel: __filemap_fdatawrite_range+0x10e/0x1e0 kernel: file_write_and_wait_range+0x48/0xb0 kernel: blkdev_fsync+0x2e/0x90 kernel: do_fsync+0x33/0x60 kernel: __x64_sys_fsync+0x14/0x30 kernel: do_syscall_64+0x85/0x280 kernel: entry_SYSCALL_64_after_hwframe+0x49/0xbe kernel: RIP: 0033:0x7f2b12b39108 kernel: Code: 00 00 48 83 ec 28 64 48 8b 04 25 28 00 00 00 48 89 44 24 18 31 c0 48 8d 05 1d c7 2c 00 8b 00 85 c0 75 27 b8 4a 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 50 48 8b 74 24 18 64 48 33 34 25 28 00 00 00 kernel: RSP: 002b:00007ffc5a0dcdd0 EFLAGS: 00000246 ORIG_RAX: 000000000000004a kernel: RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f2b12b39108 kernel: RDX: 00007f2b12e00b00 RSI: 0000000000000000 RDI: 0000000000000003 kernel: RBP: 0000000000000000 R08: 0000000000000024 R09: 00007ffc5a0dcf00 kernel: R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffc5a0dcf00 kernel: R13: 000055580a786137 R14: 00000000000061b0 R15: 0000000000000000 kernel: ================================================================================ Same system as above
...and yet another for line 50: kernel: ================================================================================ kernel: UBSAN: Undefined behaviour in ./include/uapi/linux/byteorder/little_endian.h:50:9 kernel: load of misaligned address 00000000321b0896 for type 'const __le64' kernel: which requires 8 byte alignment kernel: CPU: 0 PID: 7415 Comm: swapon Tainted: P O T 4.19.8-gentoo #1 kernel: Hardware name: ASUSTeK COMPUTER INC. G752VY/G752VY, BIOS G752VY.304 06/29/2017 kernel: Call Trace: kernel: dump_stack+0xa1/0x11b kernel: ubsan_epilogue+0x9/0x40 kernel: ubsan_type_mismatch_common+0x17b/0x190 kernel: __ubsan_handle_type_mismatch+0x43/0x60 kernel: LZ4_decompress_safe+0x6da/0x960 kernel: ? part_round_stats+0x6f/0x1c0 kernel: lz4_decompress_crypto+0x24/0x80 [lz4] kernel: zcomp_decompress+0x4b/0xb0 [zram] kernel: zram_bvec_rw.isra.11+0x86e/0x1770 [zram] kernel: zram_rw_page+0xdf/0x1a0 [zram] kernel: ? zram_bvec_rw.isra.11+0x1770/0x1770 [zram] kernel: bdev_read_page+0xdd/0x1f0 kernel: do_mpage_readpage+0x844/0x14b0 kernel: ? add_to_page_cache_lru+0xc7/0x1b0 kernel: mpage_readpages+0x196/0x380 kernel: ? block_llseek+0xa0/0xa0 kernel: ? get_page_from_freelist+0x1899/0x3690 kernel: read_pages+0xa2/0x3c0 kernel: ? __do_page_cache_readahead+0x213/0x360 kernel: __do_page_cache_readahead+0x213/0x360 kernel: ondemand_readahead+0x316/0xd90 kernel: generic_file_read_iter+0xac8/0x1920 kernel: new_sync_read+0x1d7/0x4f0 kernel: vfs_read+0xa2/0x290 kernel: ksys_read+0x5c/0x100 kernel: do_syscall_64+0x85/0x280 kernel: entry_SYSCALL_64_after_hwframe+0x49/0xbe kernel: RIP: 0033:0x7f86841cbd45 kernel: Code: 00 00 0f 1f 00 48 83 ec 38 64 48 8b 04 25 28 00 00 00 48 89 44 24 28 31 c0 48 8d 05 dd 3a 2d 00 8b 00 85 c0 75 27 31 c0 0f 05 <48> 3d 00 f0 ff ff 77 63 48 8b 4c 24 28 64 48 33 0c 25 28 00 00 00 kernel: RSP: 002b:00007ffd93dc2250 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 kernel: RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f86841cbd45 kernel: RDX: 0000000000010000 RSI: 0000557bbb60d5d0 RDI: 0000000000000003 kernel: RBP: 0000557bbb60c5c0 R08: 0000000000000003 R09: 00007f868449ae30 kernel: R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000003 kernel: R13: 00007ffd93dc2490 R14: 00007ffd93dc24cc R15: 0000557bbb60d5d0 kernel: ================================================================================
Detection of undefined behavior via the UndefinedBehaviorSanitizer can be reported upstream at https://bugzilla.kernel.org