syzbot


KASAN: use-after-free Read in xfs_inode_item_push

Status: auto-obsoleted due to no activity on 2023/08/28 08:02
Reported-by: syzbot+157a2285a060ad6f76e2@syzkaller.appspotmail.com
First crash: 367d, last: 365d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in xfs_inode_item_push xfs 16 238d 464d 0/26 auto-obsoleted due to no activity on 2024/01/02 00:00
linux-6.1 KASAN: use-after-free Read in xfs_inode_item_push 1 386d 386d 0/3 auto-obsoleted due to no activity on 2023/08/23 09:03
upstream KASAN: slab-use-after-free Read in xfs_inode_item_push xfs 19 20m 39d 0/26 upstream: reported on 2024/04/10 12:45

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in xfs_inode_item_push+0x25e/0x2c0 fs/xfs/xfs_inode_item.c:582
Read of size 8 at addr ffff8880745d7b70 by task xfsaild/loop1/2941

CPU: 1 PID: 2941 Comm: xfsaild/loop1 Not tainted 5.15.112-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 xfs_inode_item_push+0x25e/0x2c0 fs/xfs/xfs_inode_item.c:582
 xfsaild_push_item fs/xfs/xfs_trans_ail.c:414 [inline]
 xfsaild_push fs/xfs/xfs_trans_ail.c:472 [inline]
 xfsaild+0xd6d/0x2970 fs/xfs/xfs_trans_ail.c:657
 kthread+0x3f6/0x4f0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
 </TASK>

Allocated by task 2900:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 __kasan_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 xfs_inode_item_init+0x2f/0xc0 fs/xfs/xfs_inode_item.c:675
 xfs_trans_ijoin+0xb6/0xe0 fs/xfs/libxfs/xfs_trans_inode.c:36
 xfs_init_new_inode+0xd8c/0x1100 fs/xfs/xfs_inode.c:918
 xfs_create+0x9b1/0x1370 fs/xfs/xfs_inode.c:1044
 xfs_generic_create+0x426/0xd70 fs/xfs/xfs_iops.c:197
 lookup_open fs/namei.c:3392 [inline]
 open_last_lookups fs/namei.c:3462 [inline]
 path_openat+0x12f6/0x2f20 fs/namei.c:3669
 do_filp_open+0x21c/0x460 fs/namei.c:3699
 do_sys_openat2+0x13b/0x500 fs/open.c:1211
 do_sys_open fs/open.c:1227 [inline]
 __do_sys_open fs/open.c:1235 [inline]
 __se_sys_open fs/open.c:1231 [inline]
 __x64_sys_open+0x221/0x270 fs/open.c:1231
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 2960:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kmem_cache_free+0x91/0x1f0 mm/slub.c:3515
 xfs_inode_free_callback+0x1bd/0x230 fs/xfs/xfs_icache.c:142
 rcu_do_batch kernel/rcu/tree.c:2510 [inline]
 rcu_core+0xa15/0x1650 kernel/rcu/tree.c:2750
 __do_softirq+0x3b3/0x93a kernel/softirq.c:558

The buggy address belongs to the object at ffff8880745d7b40
 which belongs to the cache xfs_ili of size 256
The buggy address is located 48 bytes inside of
 256-byte region [ffff8880745d7b40, ffff8880745d7c40)
The buggy address belongs to the page:
page:ffffea0001d175c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880745d7780 pfn:0x745d7
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 0000000000000000 dead000000000122 ffff88801942a3c0
raw: ffff8880745d7780 00000000800c0004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Reclaimable, gfp_mask 0x112c50(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 25782, ts 1029264498396, free_ts 1019792123633
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5421
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0x18e/0x280 mm/slub.c:3233
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 xfs_inode_item_init+0x2f/0xc0 fs/xfs/xfs_inode_item.c:675
 xfs_trans_ijoin+0xb6/0xe0 fs/xfs/libxfs/xfs_trans_inode.c:36
 xfs_init_new_inode+0xd8c/0x1100 fs/xfs/xfs_inode.c:918
 xfs_create_tmpfile+0x655/0xb60 fs/xfs/xfs_inode.c:1168
 xfs_rename_alloc_whiteout fs/xfs/xfs_inode.c:3067 [inline]
 xfs_rename+0x2c2/0x1f70 fs/xfs/xfs_inode.c:3122
 xfs_vn_rename+0x384/0x4d0 fs/xfs/xfs_iops.c:475
 vfs_rename+0xd8f/0x1190 fs/namei.c:4736
 ovl_do_rename fs/overlayfs/overlayfs.h:234 [inline]
 ovl_check_rename_whiteout fs/overlayfs/super.c:1290 [inline]
 ovl_make_workdir fs/overlayfs/super.c:1409 [inline]
 ovl_get_workdir+0x861/0x1350 fs/overlayfs/super.c:1524
 ovl_fill_super+0x1b85/0x2a20 fs/overlayfs/super.c:2080
 mount_nodev+0x52/0xe0 fs/super.c:1424
 legacy_get_tree+0xeb/0x180 fs/fs_context.c:610
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 free_slab mm/slub.c:2015 [inline]
 discard_slab mm/slub.c:2021 [inline]
 __unfreeze_partials+0x1b7/0x210 mm/slub.c:2507
 put_cpu_partial+0x132/0x1a0 mm/slub.c:2587
 do_slab_free mm/slub.c:3487 [inline]
 ___cache_free+0xe3/0x100 mm/slub.c:3506
 qlist_free_all+0x36/0x90 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x162/0x180 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xc0 mm/kasan/common.c:444
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
 getname_flags+0xb8/0x4e0 fs/namei.c:138
 do_sys_openat2+0xd2/0x500 fs/open.c:1205
 do_sys_open fs/open.c:1227 [inline]
 __do_sys_openat fs/open.c:1243 [inline]
 __se_sys_openat fs/open.c:1238 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1238
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Memory state around the buggy address:
 ffff8880745d7a00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880745d7a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880745d7b00: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
                                                             ^
 ffff8880745d7b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880745d7c00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/05/20 08:02 linux-5.15.y 9d6bde853685 96689200 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in xfs_inode_item_push
2023/05/17 19:05 linux-5.15.y 9d6bde853685 eaac4681 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in xfs_inode_item_push
* Struck through repros no longer work on HEAD.