syzbot


KASAN: use-after-free Read in xfs_inode_item_push

Status: auto-obsoleted due to no activity on 2024/01/02 00:00
Subsystems: xfs
[Documentation on labels]
Reported-by: syzbot+f0da51f81ea0b040c803@syzkaller.appspotmail.com
First crash: 655d, last: 426d
Discussions (3)
Title Replies (including bot) Last reply
[syzbot] Monthly xfs report (Jun 2023) 0 (1) 2023/06/07 09:24
[syzbot] Monthly xfs report (May 2023) 1 (2) 2023/05/05 13:59
[syzbot] [xfs?] KASAN: use-after-free Read in xfs_inode_item_push 0 (1) 2023/02/10 06:33
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: use-after-free Read in xfs_inode_item_push (2) 1 78d 78d 0/3 upstream: reported on 2024/09/05 11:37
linux-6.1 KASAN: use-after-free Read in xfs_inode_item_push 1 573d 573d 0/3 auto-obsoleted due to no activity on 2023/08/23 09:03
linux-5.15 KASAN: use-after-free Read in xfs_inode_item_push 2 552d 555d 0/3 auto-obsoleted due to no activity on 2023/08/28 08:02
upstream KASAN: slab-use-after-free Read in xfs_inode_item_push xfs C error 130 9h28m 226d 0/28 upstream: reported C repro on 2024/04/10 12:45

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in xfs_inode_item_push+0x338/0x350 fs/xfs/xfs_inode_item.c:594
Read of size 8 at addr ffff88804bb907e0 by task xfsaild/loop3/17189

CPU: 0 PID: 17189 Comm: xfsaild/loop3 Not tainted 6.2.0-rc7-syzkaller-00002-gd2d11f342b17 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:306 [inline]
 print_report+0x15e/0x45d mm/kasan/report.c:417
 kasan_report+0xbf/0x1f0 mm/kasan/report.c:517
 xfs_inode_item_push+0x338/0x350 fs/xfs/xfs_inode_item.c:594
 xfsaild_push_item fs/xfs/xfs_trans_ail.c:414 [inline]
 xfsaild_push fs/xfs/xfs_trans_ail.c:486 [inline]
 xfsaild+0xd0f/0x27f0 fs/xfs/xfs_trans_ail.c:671
 kthread+0x2e8/0x3a0 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
 </TASK>

Allocated by task 17140:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 __kasan_slab_alloc+0x82/0x90 mm/kasan/common.c:325
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook mm/slab.h:761 [inline]
 slab_alloc_node mm/slub.c:3452 [inline]
 slab_alloc mm/slub.c:3460 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3467 [inline]
 kmem_cache_alloc+0x1e4/0x430 mm/slub.c:3476
 kmem_cache_zalloc include/linux/slab.h:710 [inline]
 xfs_inode_item_init+0x24/0xc0 fs/xfs/xfs_inode_item.c:687
 xfs_trans_ijoin+0xb3/0x100 fs/xfs/libxfs/xfs_trans_inode.c:36
 xfs_init_new_inode+0x628/0x1910 fs/xfs/xfs_inode.c:902
 xfs_create+0x77a/0x1250 fs/xfs/xfs_inode.c:1023
 xfs_generic_create+0x5ee/0x790 fs/xfs/xfs_iops.c:199
 lookup_open.isra.0+0xee7/0x1270 fs/namei.c:3413
 open_last_lookups fs/namei.c:3481 [inline]
 path_openat+0x975/0x2a50 fs/namei.c:3711
 do_filp_open+0x1ba/0x410 fs/namei.c:3741
 do_sys_openat2+0x16d/0x4c0 fs/open.c:1310
 do_sys_open fs/open.c:1326 [inline]
 __do_sys_open fs/open.c:1334 [inline]
 __se_sys_open fs/open.c:1330 [inline]
 __x64_sys_open+0x11d/0x1c0 fs/open.c:1330
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Freed by task 5137:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:518
 ____kasan_slab_free mm/kasan/common.c:236 [inline]
 ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1781 [inline]
 slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1807
 slab_free mm/slub.c:3787 [inline]
 kmem_cache_free+0xee/0x5c0 mm/slub.c:3809
 xfs_inode_free_callback+0x159/0x240 fs/xfs/xfs_icache.c:145
 rcu_do_batch kernel/rcu/tree.c:2246 [inline]
 rcu_core+0x81f/0x1980 kernel/rcu/tree.c:2506
 __do_softirq+0x1fb/0xadc kernel/softirq.c:571

The buggy address belongs to the object at ffff88804bb907b0
 which belongs to the cache xfs_ili of size 264
The buggy address is located 48 bytes inside of
 264-byte region [ffff88804bb907b0, ffff88804bb908b8)

The buggy address belongs to the physical page:
page:ffffea00012ee400 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88804bb90520 pfn:0x4bb90
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffff88801bf9fdc0 dead000000000122 0000000000000000
raw: ffff88804bb90520 00000000800c0006 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 12970, tgid 12969 (syz-executor.2), ts 689997984493, free_ts 627929371073
 prep_new_page mm/page_alloc.c:2531 [inline]
 get_page_from_freelist+0x119c/0x2ce0 mm/page_alloc.c:4283
 __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5549
 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2287
 alloc_slab_page mm/slub.c:1851 [inline]
 allocate_slab+0x25f/0x350 mm/slub.c:1998
 new_slab mm/slub.c:2051 [inline]
 ___slab_alloc+0xa91/0x1400 mm/slub.c:3193
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3292
 __slab_alloc_node mm/slub.c:3345 [inline]
 slab_alloc_node mm/slub.c:3442 [inline]
 slab_alloc mm/slub.c:3460 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3467 [inline]
 kmem_cache_alloc+0x379/0x430 mm/slub.c:3476
 kmem_cache_zalloc include/linux/slab.h:710 [inline]
 xfs_inode_item_init+0x24/0xc0 fs/xfs/xfs_inode_item.c:687
 xfs_trans_ijoin+0xb3/0x100 fs/xfs/libxfs/xfs_trans_inode.c:36
 xfs_trans_alloc_ichange+0x156/0x590 fs/xfs/xfs_trans.c:1298
 xfs_setattr_nonsize+0x18b/0xed0 fs/xfs/xfs_iops.c:709
 xfs_vn_setattr+0x358/0x8d0 fs/xfs/xfs_iops.c:1024
 notify_change+0xca7/0x1420 fs/attr.c:482
 chown_common+0x60a/0x6f0 fs/open.c:736
 do_fchownat+0x12a/0x1e0 fs/open.c:767
 __do_sys_lchown fs/open.c:792 [inline]
 __se_sys_lchown fs/open.c:790 [inline]
 __x64_sys_lchown+0x7e/0xc0 fs/open.c:790
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1446 [inline]
 free_pcp_prepare+0x65c/0xc00 mm/page_alloc.c:1496
 free_unref_page_prepare mm/page_alloc.c:3369 [inline]
 free_unref_page+0x1d/0x490 mm/page_alloc.c:3464
 qlink_free mm/kasan/quarantine.c:168 [inline]
 qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x192/0x220 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x66/0x90 mm/kasan/common.c:302
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook mm/slab.h:761 [inline]
 slab_alloc_node mm/slub.c:3452 [inline]
 __kmem_cache_alloc_node+0x1ea/0x430 mm/slub.c:3491
 __do_kmalloc_node mm/slab_common.c:967 [inline]
 __kmalloc+0x4a/0xd0 mm/slab_common.c:981
 kmalloc include/linux/slab.h:584 [inline]
 kzalloc include/linux/slab.h:720 [inline]
 tomoyo_encode2.part.0+0xe9/0x3a0 security/tomoyo/realpath.c:45
 tomoyo_encode2 security/tomoyo/realpath.c:31 [inline]
 tomoyo_encode+0x2c/0x50 security/tomoyo/realpath.c:80
 tomoyo_path_perm+0x391/0x430 security/tomoyo/file.c:831
 tomoyo_path_symlink+0x98/0xe0 security/tomoyo/tomoyo.c:211
 security_path_symlink+0xe3/0x160 security/security.c:1212
 do_symlinkat+0x10a/0x2c0 fs/namei.c:4425
 __do_sys_symlink fs/namei.c:4452 [inline]
 __se_sys_symlink fs/namei.c:4450 [inline]
 __x64_sys_symlink+0x79/0x90 fs/namei.c:4450
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffff88804bb90680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88804bb90700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc
>ffff88804bb90780: fc fc fc fc fc fc fa fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff88804bb90800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88804bb90880: fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc fa
==================================================================

Crashes (16):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/02/06 05:55 upstream d2d11f342b17 be607b78 .config console log report info ci-upstream-kasan-gce-root KASAN: use-after-free Read in xfs_inode_item_push
2023/09/23 23:59 upstream d90b0276af8f 0b6a67ac .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in xfs_inode_item_push
2023/07/01 11:35 upstream a507db1d8fdc bfc47836 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in xfs_inode_item_push
2023/06/24 10:27 upstream 61dabacdad4e 79782afc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in xfs_inode_item_push
2023/05/27 19:56 upstream 49572d536129 cf184559 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in xfs_inode_item_push
2023/05/20 07:38 upstream cbd6ac3837cd 96689200 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in xfs_inode_item_push
2023/05/05 13:44 upstream 78b421b6a7c6 518a39a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in xfs_inode_item_push
2023/05/04 17:22 upstream 1a5304fecee5 518a39a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in xfs_inode_item_push
2023/05/03 18:24 upstream 348551ddaf31 b5918830 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in xfs_inode_item_push
2023/05/03 15:13 upstream 348551ddaf31 b5918830 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in xfs_inode_item_push
2023/05/01 18:57 upstream 58390c8ce1bd 62df2017 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in xfs_inode_item_push
2023/04/29 19:23 upstream 89d77f71f493 62df2017 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in xfs_inode_item_push
2023/04/26 04:49 upstream 0cfd8703e7da 65320f8e .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in xfs_inode_item_push
2023/04/23 20:15 upstream 622322f53c6d 2b32bd34 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in xfs_inode_item_push
2023/04/21 20:52 upstream 2af3e53a4dc0 2b32bd34 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in xfs_inode_item_push
2023/04/12 16:49 upstream e62252bc55b6 1a1596b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in xfs_inode_item_push
* Struck through repros no longer work on HEAD.