openzfs / zfs

OpenZFS on Linux and FreeBSD
https://openzfs.github.io/openzfs-docs
Other
10.64k stars 1.75k forks source link

UBSAN complains about undefined behavior. #10780

Open L117 opened 4 years ago

L117 commented 4 years ago

System information

Type Version/Name
Distribution Name Gentoo
Distribution Version N/A
Linux Kernel 5.4.48-gentoo
Architecture amd64
ZFS Version 0.8.4-r1-gentoo
SPL Version 0.8.4-r1-gentoo

Describe the problem you're observing

I see stack traces in my dmesg. Occasional system hang-ups may also be related to this issue.

Describe how to reproduce the problem

  1. Build kernel with CONFIG_UBSAN=y.
  2. Boot system with zfs module loaded.
  3. Invoke dmesg.

Include any warning/errors/backtraces from the system logs

[    7.125245] ================================================================================
[    7.126694] UBSAN: Undefined behaviour in /var/tmp/portage/sys-fs/zfs-kmod-0.8.4-r1/work/zfs-0.8.4/module/zfs/vdev_label.c:600:14
[    7.129768] shift exponent 64 is too large for 64-bit type 'long long unsigned int'
[    7.131455] CPU: 0 PID: 476 Comm: zpool Tainted: P           O      5.4.48-gentoo #5
[    7.131456] Hardware name: To be filled by O.E.M. To be filled by O.E.M./SABERTOOTH 990FX R2.0, BIOS 2901 05/04/2016
[    7.131457] Call Trace:
[    7.131465]  dump_stack+0x66/0x90
[    7.131468]  ubsan_epilogue+0x5/0x21
[    7.131470]  __ubsan_handle_shift_out_of_bounds.cold+0x5a/0x107
[    7.131472]  ? _raw_spin_unlock+0x16/0x30
[    7.131496]  dsl_dataset_get_holds+0x6f8c1/0x728b3 [zfs]
[    7.131501]  ? spl_kmem_alloc+0xd9/0x110 [spl]
[    7.131518]  vdev_config_generate+0x490/0x900 [zfs]
[    7.131537]  spa_config_generate+0x202/0x920 [zfs]
[    7.131541]  ? zpool_get_load_policy+0x69/0x1c0 [zcommon]
[    7.131557]  spa_tryimport+0x13e/0x530 [zfs]
[    7.131575]  zfs_secpolicy_smb_acl+0x4d73/0x79f0 [zfs]
[    7.131592]  zfs_secpolicy_smb_acl+0x57d5/0x79f0 [zfs]
[    7.131596]  ? __lru_cache_add+0xab/0x100
[    7.131597]  ? _raw_spin_unlock+0x16/0x30
[    7.131600]  ? __handle_mm_fault+0xb94/0x1480
[    7.131602]  do_vfs_ioctl+0x40c/0x670
[    7.131604]  ksys_ioctl+0x5e/0x90
[    7.131606]  __x64_sys_ioctl+0x16/0x20
[    7.131610]  do_syscall_64+0x52/0x190
[    7.131611]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[    7.131613] RIP: 0033:0x7f3983c96257
[    7.131616] Code: 00 00 90 48 8b 05 39 3c 0c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 09 3c 0c 00 f7 d8 64 89 01 48
[    7.131617] RSP: 002b:00007ffc19d05088 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[    7.131618] RAX: ffffffffffffffda RBX: 000055d6a03f6e80 RCX: 00007f3983c96257
[    7.131619] RDX: 00007ffc19d050a0 RSI: 0000000000005a06 RDI: 0000000000000003
[    7.131620] RBP: 00007ffc19d08670 R08: 00007f3983777010 R09: 0000000000000000
[    7.131620] R10: 0000000000000022 R11: 0000000000000246 R12: 000055d6a03f5730
[    7.131621] R13: 00007ffc19d050a0 R14: 000055d6a03f6f40 R15: 000055d6a03f6370
[    7.131623] ================================================================================
[    7.133306] ================================================================================
[    7.135014] UBSAN: Undefined behaviour in /var/tmp/portage/sys-fs/zfs-kmod-0.8.4-r1/work/zfs-0.8.4/module/zfs/vdev_label.c:602:39
[    7.138530] shift exponent 64 is too large for 64-bit type 'long long unsigned int'
[    7.140397] CPU: 0 PID: 476 Comm: zpool Tainted: P           O      5.4.48-gentoo #5
[    7.140397] Hardware name: To be filled by O.E.M. To be filled by O.E.M./SABERTOOTH 990FX R2.0, BIOS 2901 05/04/2016
[    7.140398] Call Trace:
[    7.140400]  dump_stack+0x66/0x90
[    7.140402]  ubsan_epilogue+0x5/0x21
[    7.140403]  __ubsan_handle_shift_out_of_bounds.cold+0x5a/0x107
[    7.140405]  ? _raw_spin_unlock+0x16/0x30
[    7.140419]  dsl_dataset_get_holds+0x6f903/0x728b3 [zfs]
[    7.140422]  ? spl_kmem_alloc+0xd9/0x110 [spl]
[    7.140438]  vdev_config_generate+0x490/0x900 [zfs]
[    7.140455]  spa_config_generate+0x202/0x920 [zfs]
[    7.140457]  ? zpool_get_load_policy+0x69/0x1c0 [zcommon]
[    7.140473]  spa_tryimport+0x13e/0x530 [zfs]
[    7.140490]  zfs_secpolicy_smb_acl+0x4d73/0x79f0 [zfs]
[    7.140505]  zfs_secpolicy_smb_acl+0x57d5/0x79f0 [zfs]
[    7.140507]  ? __lru_cache_add+0xab/0x100
[    7.140509]  ? _raw_spin_unlock+0x16/0x30
[    7.140511]  ? __handle_mm_fault+0xb94/0x1480
[    7.140512]  do_vfs_ioctl+0x40c/0x670
[    7.140514]  ksys_ioctl+0x5e/0x90
[    7.140516]  __x64_sys_ioctl+0x16/0x20
[    7.140517]  do_syscall_64+0x52/0x190
[    7.140518]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[    7.140520] RIP: 0033:0x7f3983c96257
[    7.140521] Code: 00 00 90 48 8b 05 39 3c 0c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 09 3c 0c 00 f7 d8 64 89 01 48
[    7.140522] RSP: 002b:00007ffc19d05088 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[    7.140523] RAX: ffffffffffffffda RBX: 000055d6a03f6e80 RCX: 00007f3983c96257
[    7.140524] RDX: 00007ffc19d050a0 RSI: 0000000000005a06 RDI: 0000000000000003
[    7.140524] RBP: 00007ffc19d08670 R08: 00007f3983777010 R09: 0000000000000000
[    7.140525] R10: 0000000000000022 R11: 0000000000000246 R12: 000055d6a03f5730
[    7.140526] R13: 00007ffc19d050a0 R14: 000055d6a03f6f40 R15: 000055d6a03f6370
[    7.140528] ================================================================================
stale[bot] commented 3 years ago

This issue has been automatically marked as "stale" because it has not had any activity for a while. It will be closed in 90 days if no further activity occurs. Thank you for your contributions.