syzbot


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

Status: upstream: reported C repro on 2024/07/21 20:19
Reported-by: syzbot+ed1375847e58c67f38b8@syzkaller.appspotmail.com
First crash: 68d, last: 12h46m
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: use-after-free Read in ext4_htree_fill_tree 1 15d 15d 0/3 upstream: reported on 2024/09/13 07:44
Last patch testing requests (4)
Created Duration User Patch Repo Result
2024/08/04 22:18 13m retest repro android13-5.10-lts report log
2024/08/04 22:18 12m retest repro android13-5.10-lts report log
2024/08/04 22:18 13m retest repro android13-5.10-lts report log
2024/08/04 22:18 5m retest repro android13-5.10-lts report log
Fix bisection attempts (1)
Created Duration User Patch Repo Result
2024/09/09 00:15 40m bisect fix android13-5.10-lts OK (0) job log log

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in ext4_htree_fill_tree+0x1316/0x13e0 fs/ext4/namei.c:1221
Read of size 1 at addr ffff888101b97a67 by task syz-executor369/296

CPU: 1 PID: 296 Comm: syz-executor369 Not tainted 5.10.225-syzkaller-00513-g8d23314f588a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
 print_address_description+0x81/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:452
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report_generic.c:306
 ext4_htree_fill_tree+0x1316/0x13e0 fs/ext4/namei.c:1221
 ext4_dx_readdir fs/ext4/dir.c:598 [inline]
 ext4_readdir+0x2dde/0x37c0 fs/ext4/dir.c:142
 iterate_dir+0x265/0x580
 __do_sys_getdents64 fs/readdir.c:369 [inline]
 __se_sys_getdents64+0x1c1/0x460 fs/readdir.c:354
 __x64_sys_getdents64+0x7b/0x90 fs/readdir.c:354
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7fde35b44823
Code: c1 66 0f 1f 44 00 00 48 83 c4 08 48 89 ef 5b 5d e9 92 11 fb 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 b8 ff ff ff f7 d8
RSP: 002b:00007fff02002b68 EFLAGS: 00000293
 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 0000555589b7a830 RCX: 00007fde35b44823
RDX: 0000000000008000 RSI: 0000555589b7a830 RDI: 0000000000000004
RBP: 0000555589b7a804 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000001000 R11: 0000000000000293 R12: ffffffffffffffb8
R13: 0000000000000010 R14: 0000555589b7a800 R15: 0000000000000001

Allocated by task 94:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:430 [inline]
 __kasan_slab_alloc+0xb1/0xe0 mm/kasan/common.c:463
 kasan_slab_alloc include/linux/kasan.h:244 [inline]
 slab_post_alloc_hook+0x61/0x2f0 mm/slab.h:583
 slab_alloc_node mm/slub.c:2947 [inline]
 slab_alloc mm/slub.c:2955 [inline]
 kmem_cache_alloc+0x168/0x2e0 mm/slub.c:2960
 getname_flags+0xba/0x520 fs/namei.c:141
 user_path_at_empty+0x2d/0x50 fs/namei.c:2740
 user_path_at include/linux/namei.h:60 [inline]
 vfs_statx+0x106/0x3b0 fs/stat.c:193
 vfs_fstatat fs/stat.c:215 [inline]
 __do_sys_newfstatat fs/stat.c:383 [inline]
 __se_sys_newfstatat+0xc8/0x760 fs/stat.c:377
 __x64_sys_newfstatat+0x9b/0xb0 fs/stat.c:377
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 94:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x121/0x160 mm/kasan/common.c:362
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:370
 kasan_slab_free include/linux/kasan.h:220 [inline]
 slab_free_hook mm/slub.c:1595 [inline]
 slab_free_freelist_hook+0xc0/0x190 mm/slub.c:1621
 slab_free mm/slub.c:3203 [inline]
 kmem_cache_free+0xa9/0x1e0 mm/slub.c:3219
 putname fs/namei.c:262 [inline]
 filename_lookup+0x515/0x6f0 fs/namei.c:2470
 user_path_at_empty+0x40/0x50 fs/namei.c:2740
 user_path_at include/linux/namei.h:60 [inline]
 vfs_statx+0x106/0x3b0 fs/stat.c:193
 vfs_fstatat fs/stat.c:215 [inline]
 __do_sys_newfstatat fs/stat.c:383 [inline]
 __se_sys_newfstatat+0xc8/0x760 fs/stat.c:377
 __x64_sys_newfstatat+0x9b/0xb0 fs/stat.c:377
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff888101b96600
 which belongs to the cache names_cache of size 4096
The buggy address is located 1127 bytes to the right of
 4096-byte region [ffff888101b96600, ffff888101b97600)
The buggy address belongs to the page:
page:ffffea000406e400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101b90
head:ffffea000406e400 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 dead000000000100 dead000000000122 ffff888100192600
raw: 0000000000000000 0000000000070007 00000001ffffffff 0000000000000000
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 94, ts 22947807283, free_ts 22648254027
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2456 [inline]
 prep_new_page+0x166/0x180 mm/page_alloc.c:2462
 get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254
 __alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5348
 allocate_slab mm/slub.c:1808 [inline]
 new_slab+0x80/0x400 mm/slub.c:1869
 new_slab_objects mm/slub.c:2627 [inline]
 ___slab_alloc+0x302/0x4b0 mm/slub.c:2791
 __slab_alloc+0x63/0xa0 mm/slub.c:2831
 slab_alloc_node mm/slub.c:2913 [inline]
 slab_alloc mm/slub.c:2955 [inline]
 kmem_cache_alloc+0x1b9/0x2e0 mm/slub.c:2960
 getname_flags+0xba/0x520 fs/namei.c:141
 getname+0x19/0x20 fs/namei.c:212
 do_sys_openat2+0xd7/0x710 fs/open.c:1211
 do_sys_open fs/open.c:1233 [inline]
 __do_sys_openat fs/open.c:1249 [inline]
 __se_sys_openat fs/open.c:1244 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1244
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:28 [inline]
 free_pages_prepare mm/page_alloc.c:1349 [inline]
 __free_pages_ok+0x82c/0x850 mm/page_alloc.c:1629
 free_the_page+0x76/0x370 mm/page_alloc.c:5409
 __free_pages+0x67/0xc0 mm/page_alloc.c:5418
 __free_slab+0xcf/0x190 mm/slub.c:1894
 free_slab mm/slub.c:1909 [inline]
 discard_slab mm/slub.c:1915 [inline]
 unfreeze_partials+0x15e/0x190 mm/slub.c:2410
 put_cpu_partial+0xbf/0x180 mm/slub.c:2446
 __slab_free+0x2c8/0x3a0 mm/slub.c:3095
 do_slab_free mm/slub.c:3191 [inline]
 ___cache_free+0x111/0x130 mm/slub.c:3210
 qlink_free+0x50/0x90 mm/kasan/quarantine.c:157
 qlist_free_all+0x47/0xb0 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x15a/0x170 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:440
 kasan_slab_alloc include/linux/kasan.h:244 [inline]
 slab_post_alloc_hook+0x61/0x2f0 mm/slab.h:583
 slab_alloc_node mm/slub.c:2947 [inline]
 slab_alloc mm/slub.c:2955 [inline]
 kmem_cache_alloc+0x168/0x2e0 mm/slub.c:2960
 kmem_cache_alloc_node include/linux/slab.h:423 [inline]
 __alloc_skb+0x80/0x510 net/core/skbuff.c:200
 alloc_skb include/linux/skbuff.h:1126 [inline]
 netlink_alloc_large_skb net/netlink/af_netlink.c:1194 [inline]
 netlink_sendmsg+0x7a4/0xd00 net/netlink/af_netlink.c:1891

Memory state around the buggy address:
 ffff888101b97900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888101b97980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888101b97a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                                       ^
 ffff888101b97a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888101b97b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (9):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/09/27 11:44 android13-5.10-lts 8d23314f588a 9314348a .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-10 KASAN: slab-out-of-bounds Read in ext4_htree_fill_tree
2024/07/21 22:17 android13-5.10-lts 1240968f7644 b88348e9 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-10 KASAN: slab-out-of-bounds Read in ext4_htree_fill_tree
2024/07/21 20:54 android13-5.10-lts 1240968f7644 b88348e9 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-10 KASAN: slab-out-of-bounds Read in ext4_htree_fill_tree
2024/07/21 20:10 android13-5.10-lts 1240968f7644 b88348e9 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-10 KASAN: slab-out-of-bounds Read in ext4_htree_fill_tree
2024/09/28 01:34 android13-5.10-lts 8d23314f588a 440b26ec .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-10 KASAN: use-after-free Read in ext4_htree_fill_tree
2024/07/21 21:36 android13-5.10-lts 1240968f7644 b88348e9 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-10 KASAN: use-after-free Read in ext4_htree_fill_tree
2024/09/27 13:19 android13-5.10-lts 8d23314f588a 9314348a .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-10 KASAN: slab-out-of-bounds Read in ext4_htree_fill_tree
2024/09/27 10:29 android13-5.10-lts 8d23314f588a 9314348a .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-10 KASAN: slab-out-of-bounds Read in ext4_htree_fill_tree
2024/07/21 19:23 android13-5.10-lts 1240968f7644 b88348e9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: slab-out-of-bounds Read in ext4_htree_fill_tree
* Struck through repros no longer work on HEAD.