syzbot


KASAN: slab-out-of-bounds Read in filldir64

Status: moderation: reported on 2025/01/13 04:00
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+70105a91de20299bfbdd@syzkaller.appspotmail.com
First crash: 6d04h, last: 6d04h

Sample crash report:
loop0: detected capacity change from 0 to 1024
EXT4-fs: Ignoring removed i_version option
EXT4-fs: Quota format mount options ignored when QUOTA feature is enabled
EXT4-fs (loop0): mounted filesystem 00000000-0000-0000-0000-000000000000 r/w without journal. Quota mode: writeback.
EXT4-fs error (device loop0): ext4_xattr_ibody_find:2240: inode #15: comm syz.0.0: corrupted in-inode xattr: ea_inode specified without ea_inode feature enabled
EXT4-fs error (device loop0): ext4_xattr_ibody_find:2240: inode #15: comm syz.0.0: corrupted in-inode xattr: ea_inode specified without ea_inode feature enabled
loop0: detected capacity change from 1024 to 960
EXT4-fs error (device loop0): ext4_xattr_ibody_find:2240: inode #12: comm syz.0.0: corrupted in-inode xattr: bad magic number in in-inode xattr
==================================================================
BUG: KASAN: slab-out-of-bounds in memchr+0x5e/0x70 lib/string.c:802
Read of size 1 at addr ffff88803df4b7bc by task syz.0.0/5313

CPU: 0 UID: 0 PID: 5313 Comm: syz.0.0 Not tainted 6.13.0-rc6-syzkaller-00046-g0b7958fa05d5 #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
 memchr+0x5e/0x70 lib/string.c:802
 verify_dirent_name fs/readdir.c:152 [inline]
 filldir64+0x5d/0x690 fs/readdir.c:355
 dir_emit include/linux/fs.h:3745 [inline]
 ext4_read_inline_dir+0xb4e/0xe60 fs/ext4/inline.c:1569
 ext4_readdir+0x475/0x3a60 fs/ext4/dir.c:159
 iterate_dir+0x571/0x800 fs/readdir.c:108
 __do_sys_getdents64 fs/readdir.c:403 [inline]
 __se_sys_getdents64+0x1e2/0x4b0 fs/readdir.c:389
 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:0x7f6225385d29
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:00007f6226211038 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 00007f6225575fa0 RCX: 00007f6225385d29
RDX: 0000000000001000 RSI: 0000000020000f80 RDI: 000000000000000a
RBP: 00007f6225401b08 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f6225575fa0 R15: 00007fff83a284e8
 </TASK>

Allocated by task 5313:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
 poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
 __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:394
 kasan_kmalloc include/linux/kasan.h:260 [inline]
 __do_kmalloc_node mm/slub.c:4298 [inline]
 __kmalloc_noprof+0x285/0x4c0 mm/slub.c:4310
 kmalloc_noprof include/linux/slab.h:905 [inline]
 ext4_read_inline_dir+0x31f/0xe60 fs/ext4/inline.c:1478
 ext4_readdir+0x475/0x3a60 fs/ext4/dir.c:159
 iterate_dir+0x571/0x800 fs/readdir.c:108
 __do_sys_getdents64 fs/readdir.c:403 [inline]
 __se_sys_getdents64+0x1e2/0x4b0 fs/readdir.c:389
 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

The buggy address belongs to the object at ffff88803df4b780
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 0 bytes to the right of
 allocated 60-byte region [ffff88803df4b780, ffff88803df4b7bc)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3df4b
ksm flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 04fff00000000000 ffff88801ac418c0 ffffea0000f02840 dead000000000003
raw: 0000000000000000 0000000080200020 00000001f5000000 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 0x52cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 1, tgid 1 (swapper/0), ts 17263111191, free_ts 0
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1558
 prep_new_page mm/page_alloc.c:1566 [inline]
 get_page_from_freelist+0x365c/0x37a0 mm/page_alloc.c:3476
 __alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4753
 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2269
 alloc_slab_page+0x6a/0x110 mm/slub.c:2423
 allocate_slab+0x5a/0x2b0 mm/slub.c:2589
 new_slab mm/slub.c:2642 [inline]
 ___slab_alloc+0xc27/0x14a0 mm/slub.c:3830
 __slab_alloc+0x58/0xa0 mm/slub.c:3920
 __slab_alloc_node mm/slub.c:3995 [inline]
 slab_alloc_node mm/slub.c:4156 [inline]
 __do_kmalloc_node mm/slub.c:4297 [inline]
 __kmalloc_noprof+0x2e6/0x4c0 mm/slub.c:4310
 kmalloc_noprof include/linux/slab.h:905 [inline]
 kmalloc_array_noprof include/linux/slab.h:946 [inline]
 kobj_map+0x6b/0x550 drivers/base/map.c:44
 cdev_add+0x95/0x170 fs/char_dev.c:491
 __video_register_device+0x3ac3/0x4a50 drivers/media/v4l2-core/v4l2-dev.c:1045
 video_register_device include/media/v4l2-dev.h:384 [inline]
 vivid_create_devnodes+0x1f5f/0x2c90 drivers/media/test-drivers/vivid/vivid-core.c:1677
 vivid_create_instance drivers/media/test-drivers/vivid/vivid-core.c:2040 [inline]
 vivid_probe+0x5858/0x7cf0 drivers/media/test-drivers/vivid/vivid-core.c:2093
 platform_probe+0x13a/0x1c0 drivers/base/platform.c:1404
 really_probe+0x2b8/0xad0 drivers/base/dd.c:658
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88803df4b680: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc
 ffff88803df4b700: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
>ffff88803df4b780: 00 00 00 00 00 00 00 04 fc fc fc fc fc fc fc fc
                                        ^
 ffff88803df4b800: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
 ffff88803df4b880: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/01/09 03:50 upstream 0b7958fa05d5 f3558dbf .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-out-of-bounds Read in filldir64
* Struck through repros no longer work on HEAD.