syzbot


UBSAN: shift-out-of-bounds in shmem_add_to_page_cache

Status: upstream: reported syz repro on 2025/02/04 15:34
Subsystems: mm bcachefs
[Documentation on labels]
Reported-by: syzbot+07392c132f11b1758ac3@syzkaller.appspotmail.com
First crash: 2d06h, last: 2d06h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [mm?] [bcachefs?] UBSAN: shift-out-of-bounds in shmem_add_to_page_cache 0 (1) 2025/02/04 15:34

Sample crash report:
------------[ cut here ]------------
UBSAN: shift-out-of-bounds in lib/xarray.c:196:22
shift exponent 66 is too large for 64-bit type 'unsigned long'
CPU: 0 UID: 0 PID: 5744 Comm: syz.3.50 Not tainted 6.13.0-syzkaller-09760-g69e858e0b8b2 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 ubsan_epilogue lib/ubsan.c:231 [inline]
 __ubsan_handle_shift_out_of_bounds+0x3c8/0x420 lib/ubsan.c:468
 xas_start+0x772/0x7b0 lib/xarray.c:196
 xas_find_conflict+0x14b/0xd20 lib/xarray.c:1430
 shmem_add_to_page_cache+0x81e/0xcc0 mm/shmem.c:889
 shmem_alloc_and_add_folio+0x968/0x1090 mm/shmem.c:1928
 shmem_get_folio_gfp+0x621/0x1840 mm/shmem.c:2522
 shmem_get_folio mm/shmem.c:2628 [inline]
 shmem_write_begin+0x165/0x350 mm/shmem.c:3278
 generic_perform_write+0x346/0x990 mm/filemap.c:4189
 shmem_file_write_iter+0xf9/0x120 mm/shmem.c:3454
 new_sync_write fs/read_write.c:586 [inline]
 vfs_write+0xacf/0xd10 fs/read_write.c:679
 ksys_write+0x18f/0x2b0 fs/read_write.c:731
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f17fe98b85f
Code: 89 54 24 18 48 89 74 24 10 89 7c 24 08 e8 f9 92 02 00 48 8b 54 24 18 48 8b 74 24 10 41 89 c0 8b 7c 24 08 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 31 44 89 c7 48 89 44 24 08 e8 4c 93 02 00 48
RSP: 002b:00007f17ff803df0 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000001000000 RCX: 00007f17fe98b85f
RDX: 0000000001000000 RSI: 00007f17f5600000 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000005939
R10: 0000000020005b42 R11: 0000000000000293 R12: 0000000000000003
R13: 00007f17ff803ef0 R14: 00007f17ff803eb0 R15: 00007f17f5600000
 </TASK>
---[ end trace ]---

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/02/03 00:22 upstream 69e858e0b8b2 568559e4 .config console log report syz / log [disk image (non-bootable)] [vmlinux] [kernel image] [mounted in repro] ci-snapshot-upstream-root UBSAN: shift-out-of-bounds in shmem_add_to_page_cache
* Struck through repros no longer work on HEAD.