syzbot


KASAN: use-after-free Read in ext4_htree_fill_tree

Status: auto-obsoleted due to no activity on 2024/12/22 07:44
Reported-by: syzbot+68cafda8117d7c4944b2@syzkaller.appspotmail.com
First crash: 100d, last: 100d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: slab-out-of-bounds Read in ext4_htree_fill_tree C 12 4d08h 153d 0/2 upstream: reported C repro on 2024/07/21 20:19

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ext4_htree_fill_tree+0x132e/0x13f0 fs/ext4/namei.c:1246
Read of size 1 at addr ffff888078f7823a by task syz-executor/6802

CPU: 1 PID: 6802 Comm: syz-executor Not tainted 6.1.110-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:395
 kasan_report+0x136/0x160 mm/kasan/report.c:495
 ext4_htree_fill_tree+0x132e/0x13f0 fs/ext4/namei.c:1246
 ext4_dx_readdir fs/ext4/dir.c:597 [inline]
 ext4_readdir+0x2f63/0x3950 fs/ext4/dir.c:142
 iterate_dir+0x224/0x560
 __do_sys_getdents64 fs/readdir.c:369 [inline]
 __se_sys_getdents64+0x209/0x4f0 fs/readdir.c:354
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f3cd45b0093
Code: c1 66 0f 1f 44 00 00 48 83 c4 08 48 89 ef 5b 5d e9 52 43 f8 ff 66 90 b8 ff ff ff 7f 48 39 c2 48 0f 47 d0 b8 d9 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 05 c3 0f 1f 40 00 48 c7 c2 a8 ff ff ff f7 d8
RSP: 002b:00007ffdba8e8178 EFLAGS: 00000293 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 000055558ba39600 RCX: 00007f3cd45b0093
RDX: 0000000000008000 RSI: 000055558ba39600 RDI: 0000000000000005
RBP: 000055558ba395d4 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000001000 R11: 0000000000000293 R12: ffffffffffffffa8
R13: 0000000000000010 R14: 000055558ba395d0 R15: 00007ffdba8ea420
 </TASK>

Allocated by task 6961:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 __kasan_slab_alloc+0x65/0x70 mm/kasan/common.c:328
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x52/0x3a0 mm/slab.h:737
 slab_alloc_node mm/slub.c:3398 [inline]
 slab_alloc mm/slub.c:3406 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
 kmem_cache_alloc_lru+0x10c/0x2d0 mm/slub.c:3429
 alloc_inode_sb include/linux/fs.h:3198 [inline]
 shmem_alloc_inode+0x24/0x40 mm/shmem.c:3901
 alloc_inode fs/inode.c:261 [inline]
 new_inode_pseudo+0x61/0x1d0 fs/inode.c:1055
 new_inode+0x25/0x1d0 fs/inode.c:1083
 shmem_get_inode+0x320/0xbd0 mm/shmem.c:2357
 shmem_symlink+0x119/0x740 mm/shmem.c:3153
 vfs_symlink+0x247/0x3d0 fs/namei.c:4473
 do_symlinkat+0x21e/0x390 fs/namei.c:4502
 __do_sys_symlinkat fs/namei.c:4519 [inline]
 __se_sys_symlinkat fs/namei.c:4516 [inline]
 __x64_sys_symlinkat+0x95/0xa0 fs/namei.c:4516
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 15:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516
 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook mm/slub.c:1750 [inline]
 slab_free mm/slub.c:3661 [inline]
 kmem_cache_free+0x292/0x510 mm/slub.c:3683
 rcu_do_batch kernel/rcu/tree.c:2297 [inline]
 rcu_core+0xade/0x1820 kernel/rcu/tree.c:2557
 handle_softirqs+0x2ee/0xa40 kernel/softirq.c:571
 run_ksoftirqd+0xc6/0x120 kernel/softirq.c:938
 smpboot_thread_fn+0x52c/0xa30 kernel/smpboot.c:164
 kthread+0x28d/0x320 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:486
 call_rcu+0x163/0xa10 kernel/rcu/tree.c:2845
 destroy_inode fs/inode.c:316 [inline]
 evict+0x87d/0x930 fs/inode.c:716
 do_unlinkat+0x509/0x820 fs/namei.c:4399
 __do_sys_unlink fs/namei.c:4440 [inline]
 __se_sys_unlink fs/namei.c:4438 [inline]
 __x64_sys_unlink+0x45/0x50 fs/namei.c:4438
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Second to last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:486
 call_rcu+0x163/0xa10 kernel/rcu/tree.c:2845
 destroy_inode fs/inode.c:316 [inline]
 evict+0x87d/0x930 fs/inode.c:716
 do_unlinkat+0x509/0x820 fs/namei.c:4399
 __do_sys_unlink fs/namei.c:4440 [inline]
 __se_sys_unlink fs/namei.c:4438 [inline]
 __x64_sys_unlink+0x45/0x50 fs/namei.c:4438
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff888078f78000
 which belongs to the cache shmem_inode_cache of size 1488
The buggy address is located 570 bytes inside of
 1488-byte region [ffff888078f78000, ffff888078f785d0)

The buggy address belongs to the physical page:
page:ffffea0001e3de00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x78f78
head:ffffea0001e3de00 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff88807e4ab801
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0001427600 dead000000000002 ffff88813fe48000
raw: 0000000000000000 0000000000140014 00000001ffffffff ffff88807e4ab801
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 3719, tgid 3719 (syz-executor), ts 70181050326, free_ts 69152608019
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2517
 prep_new_page mm/page_alloc.c:2524 [inline]
 get_page_from_freelist+0x322e/0x33b0 mm/page_alloc.c:4290
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5558
 alloc_slab_page+0x6a/0x150 mm/slub.c:1794
 allocate_slab mm/slub.c:1939 [inline]
 new_slab+0x84/0x2d0 mm/slub.c:1992
 ___slab_alloc+0xc20/0x1270 mm/slub.c:3180
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 slab_alloc mm/slub.c:3406 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
 kmem_cache_alloc_lru+0x1a5/0x2d0 mm/slub.c:3429
 alloc_inode_sb include/linux/fs.h:3198 [inline]
 shmem_alloc_inode+0x24/0x40 mm/shmem.c:3901
 alloc_inode fs/inode.c:261 [inline]
 new_inode_pseudo+0x61/0x1d0 fs/inode.c:1055
 new_inode+0x25/0x1d0 fs/inode.c:1083
 shmem_get_inode+0x320/0xbd0 mm/shmem.c:2357
 shmem_symlink+0x119/0x740 mm/shmem.c:3153
 vfs_symlink+0x247/0x3d0 fs/namei.c:4473
 do_symlinkat+0x21e/0x390 fs/namei.c:4502
 __do_sys_symlinkat fs/namei.c:4519 [inline]
 __se_sys_symlinkat fs/namei.c:4516 [inline]
 __x64_sys_symlinkat+0x95/0xa0 fs/namei.c:4516
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1444 [inline]
 free_pcp_prepare mm/page_alloc.c:1494 [inline]
 free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3369
 free_unref_page+0x33/0x3e0 mm/page_alloc.c:3464
 qlink_free mm/kasan/quarantine.c:168 [inline]
 qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x156/0x170 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x1f/0x70 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x52/0x3a0 mm/slab.h:737
 slab_alloc_node mm/slub.c:3398 [inline]
 __kmem_cache_alloc_node+0x137/0x260 mm/slub.c:3437
 kmalloc_trace+0x26/0xe0 mm/slab_common.c:1026
 kmalloc include/linux/slab.h:557 [inline]
 kzalloc include/linux/slab.h:693 [inline]
 nsim_fib6_rt_create drivers/net/netdevsim/fib.c:547 [inline]
 nsim_fib6_rt_insert drivers/net/netdevsim/fib.c:752 [inline]
 nsim_fib6_event drivers/net/netdevsim/fib.c:856 [inline]
 nsim_fib_event drivers/net/netdevsim/fib.c:889 [inline]
 nsim_fib_event_work+0x19be/0x4120 drivers/net/netdevsim/fib.c:1492
 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
 process_scheduled_works kernel/workqueue.c:2355 [inline]
 worker_thread+0xd04/0x1200 kernel/workqueue.c:2441
 kthread+0x28d/0x320 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Memory state around the buggy address:
 ffff888078f78100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888078f78180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888078f78200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                        ^
 ffff888078f78280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888078f78300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/09/13 07:43 linux-6.1.y 5f55cad62cc9 73e8a465 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in ext4_htree_fill_tree
* Struck through repros no longer work on HEAD.