syzbot


KASAN: stack-out-of-bounds Write in exfat_get_block

Status: closed as invalid on 2025/01/20 09:12
Subsystems: exfat
[Documentation on labels]
First crash: 115d, last: 92d

Sample crash report:
process 'syz.0.0' launched './file1' with NULL argv: empty string added
==================================================================
BUG: KASAN: stack-out-of-bounds in exfat_map_cluster fs/exfat/inode.c:234 [inline]
BUG: KASAN: stack-out-of-bounds in exfat_get_block+0x1d43/0x2180 fs/exfat/inode.c:284
Write of size 4 at addr ffffc9000b047420 by task syz.0.0/5108

CPU: 0 UID: 0 PID: 5108 Comm: syz.0.0 Not tainted 6.12.0-rc3-syzkaller-00420-g715ca9dd687f #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:377 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:488
 kasan_report+0x143/0x180 mm/kasan/report.c:601
 exfat_map_cluster fs/exfat/inode.c:234 [inline]
 exfat_get_block+0x1d43/0x2180 fs/exfat/inode.c:284
 get_more_blocks fs/direct-io.c:648 [inline]
 do_direct_IO fs/direct-io.c:936 [inline]
 __blockdev_direct_IO+0x1c8e/0x4890 fs/direct-io.c:1243
 blockdev_direct_IO include/linux/fs.h:3280 [inline]
 exfat_direct_IO+0x151/0x400 fs/exfat/inode.c:482
 generic_file_direct_write+0x17a/0x390 mm/filemap.c:3977
 __generic_file_write_iter+0x126/0x230 mm/filemap.c:4141
 exfat_file_write_iter+0x165/0x3f0 fs/exfat/file.c:598
 do_iter_readv_writev+0x600/0x880
 vfs_writev+0x376/0xba0 fs/read_write.c:1064
 do_pwritev fs/read_write.c:1165 [inline]
 __do_sys_pwritev2 fs/read_write.c:1224 [inline]
 __se_sys_pwritev2+0x1ca/0x2d0 fs/read_write.c:1215
 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:0x7f92bc17dff9
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:00007f92bbfde038 EFLAGS: 00000246 ORIG_RAX: 0000000000000148
RAX: ffffffffffffffda RBX: 00007f92bc336130 RCX: 00007f92bc17dff9
RDX: 0000000000000001 RSI: 00000000200001c0 RDI: 0000000000000007
RBP: 00007f92bc1f0296 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f92bc336130 R15: 00007fff4ed1f988
 </TASK>

The buggy address belongs to stack of task syz.0.0/5108
 and is located at offset 96 in frame:
 exfat_get_block+0x0/0x2180 fs/exfat/inode.c:530

This frame has 4 objects:
 [32, 36) 'last_clu.i'
 [48, 60) 'new_clu.i'
 [80, 84) 'fclus.i'
 [96, 100) 'cluster'

The buggy address belongs to the virtual mapping at
 [ffffc9000b040000, ffffc9000b049000) created by:
 copy_process+0x5d1/0x3d50 kernel/fork.c:2203

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4cf7a
flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff)
raw: 04fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2dc2(GFP_KERNEL|__GFP_HIGHMEM|__GFP_NOWARN|__GFP_ZERO), pid 4809, tgid 4809 (dhcpcd), ts 68004219330, free_ts 0
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1537
 prep_new_page mm/page_alloc.c:1545 [inline]
 get_page_from_freelist+0x3045/0x3190 mm/page_alloc.c:3457
 __alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4733
 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265
 vm_area_alloc_pages mm/vmalloc.c:3568 [inline]
 __vmalloc_area_node mm/vmalloc.c:3646 [inline]
 __vmalloc_node_range_noprof+0xa2b/0x13f0 mm/vmalloc.c:3828
 alloc_thread_stack_node kernel/fork.c:314 [inline]
 dup_task_struct+0x444/0x8c0 kernel/fork.c:1115
 copy_process+0x5d1/0x3d50 kernel/fork.c:2203
 kernel_clone+0x226/0x8f0 kernel/fork.c:2784
 __do_sys_clone kernel/fork.c:2927 [inline]
 __se_sys_clone kernel/fork.c:2911 [inline]
 __x64_sys_clone+0x258/0x2a0 kernel/fork.c:2911
 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
page_owner free stack trace missing

Memory state around the buggy address:
 ffffc9000b047300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc9000b047380: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 04 f2 00 04
>ffffc9000b047400: f2 f2 04 f2 04 f3 f3 f3 00 00 00 00 00 00 00 00
                               ^
 ffffc9000b047480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc9000b047500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/10/20 07:16 upstream 715ca9dd687f cd6fc0a3 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: stack-out-of-bounds Write in exfat_get_block
2024/10/20 07:16 upstream 715ca9dd687f cd6fc0a3 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: stack-out-of-bounds Write in exfat_get_block
2024/10/03 05:33 upstream f23aa4c0761a a4c7fd36 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: stack-out-of-bounds Write in exfat_get_block
2024/09/27 21:32 upstream e477dba5442c 2b1784d6 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: stack-out-of-bounds Write in exfat_get_block
* Struck through repros no longer work on HEAD.