[v5.15] KASAN: use-after-free Read in xfs_inode_item_push (2)

0 views
Skip to first unread message

syzbot

unread,
Jan 31, 2025, 4:44:22 AMJan 31
Hello,

syzbot found the following issue on:

HEAD commit: 003148680b79 Linux 5.15.177
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=130076b0580000
kernel config: https://syzkaller.appspot.com/x/.config?x=27ad1047990e0f7e
dashboard link: https://syzkaller.appspot.com/bug?extid=ac6e2c95a764b3e2d045
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/c8625d198744/disk-00314868.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/94b56bdfa2ae/vmlinux-00314868.xz
kernel image: https://storage.googleapis.com/syzbot-assets/640b14c1ba43/Image-00314868.gz.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

==================================================================
BUG: KASAN: use-after-free in xfs_inode_item_push+0x228/0x28c fs/xfs/xfs_inode_item.c:582
Read of size 8 at addr ffff0000e868d530 by task xfsaild/loop9/9082

CPU: 0 PID: 9082 Comm: xfsaild/loop9 Not tainted 5.15.177-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
Call trace:
dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
print_address_description+0x7c/0x3f0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x174/0x1e4 mm/kasan/report.c:451
__asan_report_load8_noabort+0x44/0x50 mm/kasan/report_generic.c:309
xfs_inode_item_push+0x228/0x28c 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+0xb58/0x2bfc fs/xfs/xfs_trans_ail.c:657
kthread+0x37c/0x45c kernel/kthread.c:334
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870

Allocated by task 9011:
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+0x8c/0xcc mm/kasan/common.c:467
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x74/0x3f4 mm/slab.h:519
slab_alloc_node mm/slub.c:3220 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc+0x1dc/0x45c mm/slub.c:3233
kmem_cache_zalloc include/linux/slab.h:711 [inline]
xfs_inode_item_init+0x3c/0xc0 fs/xfs/xfs_inode_item.c:675
xfs_trans_ijoin+0xc4/0xe8 fs/xfs/libxfs/xfs_trans_inode.c:36
xfs_setattr_size+0x4a8/0xc00 fs/xfs/xfs_iops.c:911
xfs_vn_setattr_size+0x1cc/0x3d8 fs/xfs/xfs_iops.c:997
xfs_vn_setattr+0x1c0/0x524 fs/xfs/xfs_iops.c:1022
notify_change+0xa34/0xcf8 fs/attr.c:505
do_truncate+0x1c0/0x28c fs/open.c:65
handle_truncate fs/namei.c:3265 [inline]
do_open fs/namei.c:3612 [inline]
path_openat+0x20c4/0x26cc fs/namei.c:3742
do_filp_open+0x1a8/0x3b4 fs/namei.c:3769
do_sys_openat2+0x128/0x3e0 fs/open.c:1253
do_sys_open fs/open.c:1269 [inline]
__do_sys_openat fs/open.c:1285 [inline]
__se_sys_openat fs/open.c:1280 [inline]
__arm64_sys_openat+0x1f0/0x240 fs/open.c:1280
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Freed by task 14:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4c/0x84 mm/kasan/common.c:46
kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360
____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366
__kasan_slab_free+0x18/0x28 mm/kasan/common.c:374
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:1705 [inline]
slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731
slab_free mm/slub.c:3499 [inline]
kmem_cache_free+0xdc/0x3c4 mm/slub.c:3515
xfs_inode_item_destroy+0x80/0x94 fs/xfs/xfs_inode_item.c:697
xfs_inode_free_callback+0x1c4/0x240 fs/xfs/xfs_icache.c:142
rcu_do_batch kernel/rcu/tree.c:2523 [inline]
rcu_core+0x830/0x1b34 kernel/rcu/tree.c:2763
rcu_core_si+0x10/0x1c kernel/rcu/tree.c:2776
handle_softirqs+0x384/0xdbc kernel/softirq.c:558
run_ksoftirqd+0x6c/0x29c kernel/softirq.c:925
smpboot_thread_fn+0x4b0/0x920 kernel/smpboot.c:164
kthread+0x37c/0x45c kernel/kthread.c:334
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870

The buggy address belongs to the object at ffff0000e868d500
which belongs to the cache xfs_ili of size 256
The buggy address is located 48 bytes inside of
256-byte region [ffff0000e868d500, ffff0000e868d600)
The buggy address belongs to the page:
page:00000000c1da97a7 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12868d
flags: 0x5ffc00000000200(slab|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000000200 0000000000000000 dead000000000122 ffff0000c68cd380
raw: 0000000000000000 00000000800c000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff0000e868d400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000e868d480: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff0000e868d500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff0000e868d580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000e868d600: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at [email protected].

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Mar 3, 2025, 2:49:21 PMMar 3
syzbot has found a reproducer for the following issue on:

HEAD commit: c16c81c81336 Linux 5.15.178
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=15df27a0580000
kernel config: https://syzkaller.appspot.com/x/.config?x=d302c69e93fb6774
dashboard link: https://syzkaller.appspot.com/bug?extid=ac6e2c95a764b3e2d045
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12de18b7980000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16eaa464580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/267e46ee7273/disk-c16c81c8.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/944e289206cf/vmlinux-c16c81c8.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f8cadf62458e/bzImage-c16c81c8.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/828925a6c214/mount_0.gz
fsck result: failed (log: https://syzkaller.appspot.com/x/fsck.log?x=10b0fa97980000)

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

==================================================================
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 ffff88806fd1bdf0 by task xfsaild/loop2/6545

CPU: 1 PID: 6545 Comm: xfsaild/loop2 Not tainted 5.15.178-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2d0 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:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
</TASK>

Allocated by task 6520:
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_qm_qino_alloc+0x516/0x9c0 fs/xfs/xfs_qm.c:790
xfs_qm_init_quotainos+0x657/0x8a0 fs/xfs/xfs_qm.c:1559
xfs_qm_init_quotainfo+0xa6/0x970 fs/xfs/xfs_qm.c:644
xfs_qm_mount_quotas+0x90/0x610 fs/xfs/xfs_qm.c:1435
xfs_mountfs+0x166a/0x1ce0 fs/xfs/xfs_mount.c:904
xfs_fs_fill_super+0x11b4/0x1400 fs/xfs/xfs_super.c:1676
get_tree_bdev+0x3fe/0x620 fs/super.c:1325
vfs_get_tree+0x88/0x270 fs/super.c:1530
do_new_mount+0x2ba/0xb40 fs/namespace.c:3012
do_mount fs/namespace.c:3355 [inline]
__do_sys_mount fs/namespace.c:3563 [inline]
__se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3540
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 6546:
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:2523 [inline]
rcu_core+0xa15/0x1650 kernel/rcu/tree.c:2763
handle_softirqs+0x3a7/0x930 kernel/softirq.c:558
__do_softirq kernel/softirq.c:592 [inline]
invoke_softirq kernel/softirq.c:432 [inline]
__irq_exit_rcu+0x157/0x240 kernel/softirq.c:641
irq_exit_rcu+0x5/0x20 kernel/softirq.c:653
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1108 [inline]
sysvec_apic_timer_interrupt+0xa0/0xc0 arch/x86/kernel/apic/apic.c:1108
asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:676

The buggy address belongs to the object at ffff88806fd1bdc0
which belongs to the cache xfs_ili of size 256
The buggy address is located 48 bytes inside of
256-byte region [ffff88806fd1bdc0, ffff88806fd1bec0)
The buggy address belongs to the page:
page:ffffea0001bf46c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x6fd1b
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea0000ae2040 0000000800000008 ffff888146a3c780
raw: 0000000000000000 00000000000c000c 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 0x12c50(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_RECLAIMABLE), pid 4165, ts 60583424245, free_ts 19117954616
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x3b78/0x3d40 mm/page_alloc.c:4192
__alloc_pages+0x272/0x700 mm/page_alloc.c:5465
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_trans_alloc_dir+0x227/0x700 fs/xfs/xfs_trans.c:1246
xfs_remove+0x3e5/0xc20 fs/xfs/xfs_inode.c:2789
xfs_vn_unlink+0x14d/0x2a0 fs/xfs/xfs_iops.c:387
vfs_unlink+0x359/0x5f0 fs/namei.c:4280
do_unlinkat+0x4a3/0x950 fs/namei.c:4348
__do_sys_unlink fs/namei.c:4396 [inline]
__se_sys_unlink fs/namei.c:4394 [inline]
__x64_sys_unlink+0x45/0x50 fs/namei.c:4394
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
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_contig_range+0x95/0xf0 mm/page_alloc.c:9384
destroy_args+0xfe/0x980 mm/debug_vm_pgtable.c:1018
debug_vm_pgtable+0x40d/0x470 mm/debug_vm_pgtable.c:1331
do_one_initcall+0x22b/0x7a0 init/main.c:1302
do_initcall_level+0x157/0x210 init/main.c:1375
do_initcalls+0x49/0x90 init/main.c:1391
kernel_init_freeable+0x425/0x5c0 init/main.c:1615
kernel_init+0x19/0x290 init/main.c:1506
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Memory state around the buggy address:
ffff88806fd1bc80: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88806fd1bd00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88806fd1bd80: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
^
ffff88806fd1be00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88806fd1be80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
Reply all
Reply to author
Forward
0 new messages