syzbot


KASAN: use-after-free Read in udf_get_fileshortad

Status: moderation: reported on 2025/01/14 22:27
Subsystems: udf
[Documentation on labels]
Reported-by: syzbot+bea9acb93d2c59e8b2b7@syzkaller.appspotmail.com
First crash: 4d10h, last: 4d10h
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KMSAN: uninit-value in udf_get_fileshortad udf C 3 107d 119d 28/28 fixed on 2024/11/12 23:31

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in udf_get_fileshortad+0x167/0x1b0 fs/udf/directory.c:513
Read of size 4 at addr ffff888052ce4000 by task syz.0.0/5320

CPU: 0 UID: 0 PID: 5320 Comm: syz.0.0 Not tainted 6.13.0-rc6-syzkaller-00130-g2144da25584e #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
 print_address_description mm/kasan/report.c:378 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:489
 kasan_report+0x143/0x180 mm/kasan/report.c:602
 udf_get_fileshortad+0x167/0x1b0 fs/udf/directory.c:513
 udf_current_aext+0x3eb/0xad0 fs/udf/inode.c:2271
 udf_next_aext+0x98/0x490 fs/udf/inode.c:2210
 udf_table_free_blocks fs/udf/balloc.c:388 [inline]
 udf_free_blocks+0xe07/0x2270 fs/udf/balloc.c:677
 extent_trunc+0x390/0x4a0 fs/udf/truncate.c:52
 udf_truncate_extents+0x449/0x1310 fs/udf/truncate.c:228
 udf_setsize+0xabb/0x1450 fs/udf/inode.c:1316
 udf_setattr+0x3c7/0x5d0 fs/udf/file.c:236
 notify_change+0xbca/0xe90 fs/attr.c:552
 do_truncate+0x220/0x310 fs/open.c:65
 handle_truncate fs/namei.c:3449 [inline]
 do_open fs/namei.c:3832 [inline]
 path_openat+0x2e1e/0x3590 fs/namei.c:3987
 do_filp_open+0x27f/0x4e0 fs/namei.c:4014
 do_sys_openat2+0x13e/0x1d0 fs/open.c:1402
 do_sys_open fs/open.c:1417 [inline]
 __do_sys_creat fs/open.c:1495 [inline]
 __se_sys_creat fs/open.c:1489 [inline]
 __x64_sys_creat+0x123/0x170 fs/open.c:1489
 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:0x7f19b0b85d29
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f19b19e5038 EFLAGS: 00000246 ORIG_RAX: 0000000000000055
RAX: ffffffffffffffda RBX: 00007f19b0d76080 RCX: 00007f19b0b85d29
RDX: 0000000000000000 RSI: 000000000000000d RDI: 0000000020000240
RBP: 00007f19b0c01b08 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f19b0d76080 R15: 00007ffc1971e3a8
 </TASK>

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x52ce4
flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff)
page_type: f0(buddy)
raw: 04fff00000000000 ffff88805ffd6ee0 ffff88805ffd6ee0 0000000000000000
raw: 0000000000000000 0000000000000002 00000000f0000000 0000000000000000
page dumped because: kasan: bad access detected
page_owner info is not present (never set?)

Memory state around the buggy address:
 ffff888052ce3f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888052ce3f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888052ce4000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff888052ce4080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888052ce4100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/01/10 22:20 upstream 2144da25584e d9381135 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: use-after-free Read in udf_get_fileshortad
* Struck through repros no longer work on HEAD.