[v6.1] KASAN: use-after-free Read in iomap_finish_ioend (2)

3 views
Skip to first unread message

syzbot

unread,
Dec 30, 2024, 12:47:24 PM12/30/24
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 563edd786f0a Linux 6.1.122
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1253a6df980000
kernel config: https://syzkaller.appspot.com/x/.config?x=4d23ad74b95a6ead
dashboard link: https://syzkaller.appspot.com/bug?extid=63c20cda94a660b51db4
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/092e3fd371c6/disk-563edd78.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/e38af8a28784/vmlinux-563edd78.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e19edf883c6a/Image-563edd78.gz.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+63c20c...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in iomap_finish_ioend+0xb1c/0xbf4 fs/iomap/buffered-io.c:1331
Read of size 8 at addr ffff0000f41cb090 by task kworker/0:12/5549

CPU: 0 PID: 5549 Comm: kworker/0:12 Tainted: G W 6.1.122-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Workqueue: xfs-conv/loop7 xfs_end_io
Call trace:
dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:316 [inline]
print_report+0x174/0x4c0 mm/kasan/report.c:427
kasan_report+0xd4/0x130 mm/kasan/report.c:531
__asan_report_load8_noabort+0x2c/0x38 mm/kasan/report_generic.c:351
iomap_finish_ioend+0xb1c/0xbf4 fs/iomap/buffered-io.c:1331
iomap_finish_ioends+0x164/0x31c fs/iomap/buffered-io.c:1355
xfs_end_ioend+0x2c0/0x404 fs/xfs/xfs_aops.c:134
xfs_end_io+0x258/0x2ec fs/xfs/xfs_aops.c:171
process_one_work+0x7ac/0x1404 kernel/workqueue.c:2292
worker_thread+0x8e4/0xfec kernel/workqueue.c:2439
kthread+0x250/0x2d8 kernel/kthread.c:376
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864

Allocated by task 6269:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505
__kasan_slab_alloc+0x74/0x8c mm/kasan/common.c:328
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook+0x74/0x458 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+0x1ac/0x2f8 mm/slub.c:3429
alloc_inode_sb include/linux/fs.h:3245 [inline]
xfs_inode_alloc+0x84/0x63c fs/xfs/xfs_icache.c:81
xfs_iget_cache_miss fs/xfs/xfs_icache.c:611 [inline]
xfs_iget+0x9fc/0x3200 fs/xfs/xfs_icache.c:777
xfs_lookup+0x288/0x548 fs/xfs/xfs_inode.c:669
xfs_vn_lookup+0x14c/0x244 fs/xfs/xfs_iops.c:304
lookup_open fs/namei.c:3460 [inline]
open_last_lookups fs/namei.c:3550 [inline]
path_openat+0xd3c/0x2548 fs/namei.c:3780
do_filp_open+0x1bc/0x3cc fs/namei.c:3810
do_sys_openat2+0x128/0x3e0 fs/open.c:1318
do_sys_open fs/open.c:1334 [inline]
__do_sys_openat fs/open.c:1350 [inline]
__se_sys_openat fs/open.c:1345 [inline]
__arm64_sys_openat+0x1f0/0x240 fs/open.c:1345
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Freed by task 21:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:516
____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236
__kasan_slab_free+0x18/0x28 mm/kasan/common.c:244
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+0x2f0/0x588 mm/slub.c:3683
xfs_inode_free_callback+0x1a8/0x1cc fs/xfs/xfs_icache.c:149
rcu_do_batch kernel/rcu/tree.c:2297 [inline]
rcu_core+0x880/0x1c48 kernel/rcu/tree.c:2557
rcu_core_si+0x10/0x1c kernel/rcu/tree.c:2574
handle_softirqs+0x318/0xd58 kernel/softirq.c:571
run_ksoftirqd+0x6c/0x29c kernel/softirq.c:938
smpboot_thread_fn+0x4b0/0x96c kernel/smpboot.c:164
kthread+0x250/0x2d8 kernel/kthread.c:376
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864

Last potentially related work creation:
kasan_save_stack+0x40/0x70 mm/kasan/common.c:45
__kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:486
kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:496
call_rcu+0xfc/0xa40 kernel/rcu/tree.c:2845
__xfs_inode_free+0x194/0x240 fs/xfs/xfs_icache.c:161
xfs_reclaim_inode fs/xfs/xfs_icache.c:979 [inline]
xfs_icwalk_process_inode fs/xfs/xfs_icache.c:1660 [inline]
xfs_icwalk_ag+0xf54/0x168c fs/xfs/xfs_icache.c:1742
xfs_icwalk fs/xfs/xfs_icache.c:1791 [inline]
xfs_reclaim_inodes+0x1ac/0x2d0 fs/xfs/xfs_icache.c:1012
xfs_unmount_flush_inodes+0xbc/0xf4 fs/xfs/xfs_mount.c:594
xfs_unmountfs+0xc4/0x268 fs/xfs/xfs_mount.c:1071
xfs_fs_put_super+0x78/0x260 fs/xfs/xfs_super.c:1119
generic_shutdown_super+0x130/0x328 fs/super.c:501
kill_block_super+0x70/0xdc fs/super.c:1470
deactivate_locked_super+0xac/0x124 fs/super.c:332
deactivate_super+0xf0/0x110 fs/super.c:363
cleanup_mnt+0x394/0x41c fs/namespace.c:1186
__cleanup_mnt+0x20/0x30 fs/namespace.c:1193
task_work_run+0x240/0x2f0 kernel/task_work.c:203
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
do_notify_resume+0x2080/0x2cb8 arch/arm64/kernel/signal.c:1132
prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
el0_svc+0x9c/0x168 arch/arm64/kernel/entry-common.c:638
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Second to last potentially related work creation:
kasan_save_stack+0x40/0x70 mm/kasan/common.c:45
__kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:486
kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:496
insert_work+0x64/0x384 kernel/workqueue.c:1361
__queue_work+0xd48/0x136c kernel/workqueue.c:1520
queue_work_on+0xc0/0x16c kernel/workqueue.c:1548
queue_work include/linux/workqueue.h:512 [inline]
xfs_end_bio+0xe4/0x1dc fs/xfs/xfs_aops.c:186
bio_endio+0x7c8/0x80c block/bio.c:1554
iomap_submit_ioend fs/iomap/buffered-io.c:1470 [inline]
iomap_writepages+0x198/0x1f4 fs/iomap/buffered-io.c:1802
xfs_vm_writepages+0x134/0x198 fs/xfs/xfs_aops.c:503
do_writepages+0x2e8/0x56c mm/page-writeback.c:2491
filemap_fdatawrite_wbc+0x124/0x174 mm/filemap.c:388
__filemap_fdatawrite_range mm/filemap.c:421 [inline]
file_write_and_wait_range+0x19c/0x28c mm/filemap.c:774
xfs_file_fsync+0x1c8/0xa14 fs/xfs/xfs_file.c:151
vfs_fsync_range+0x168/0x188 fs/sync.c:188
generic_write_sync include/linux/fs.h:2962 [inline]
xfs_file_buffered_write+0xa4c/0xba8 fs/xfs/xfs_file.c:764
xfs_file_write_iter+0x2b4/0x604 fs/xfs/xfs_file.c:802
do_iter_write+0x534/0x964 fs/read_write.c:861
vfs_writev fs/read_write.c:934 [inline]
do_pwritev+0x1ec/0x334 fs/read_write.c:1031
__do_sys_pwritev2 fs/read_write.c:1090 [inline]
__se_sys_pwritev2 fs/read_write.c:1081 [inline]
__arm64_sys_pwritev2+0xd4/0x108 fs/read_write.c:1081
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

The buggy address belongs to the object at ffff0000f41cae80
which belongs to the cache xfs_inode of size 1808
The buggy address is located 528 bytes inside of
1808-byte region [ffff0000f41cae80, ffff0000f41cb590)

The buggy address belongs to the physical page:
page:00000000d735b097 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1341c8
head:00000000d735b097 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff0000c9981a01
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 fffffc00037e6600 dead000000000002 ffff0000c6f94300
raw: 0000000000000000 0000000080100010 00000001ffffffff ffff0000c9981a01
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff0000f41caf80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000f41cb000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff0000f41cb080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff0000f41cb100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000f41cb180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
loop7: writeback error on inode 6150, offset 0, sector 12252
XFS (loop6): Metadata CRC error detected at xfs_allocbt_read_verify+0x50/0x108 fs/xfs/libxfs/xfs_alloc_btree.c:338, xfs_bnobt block 0x4
XFS (loop6): Unmount and run xfs_repair
XFS (loop6): First 128 bytes of corrupted metadata buffer:
00000000: 41 42 33 42 00 00 00 03 ff ff ff ff ff ff ff ff AB3B............
00000010: 00 00 00 00 00 00 00 04 00 00 00 01 00 00 00 10 ................
00000020: ed 37 bf 6e 74 ea 4e 01 f8 ba 5f ee 27 4b 0f 3a .7.nt.N..._.'K.:
00000030: 00 00 00 00 f6 3b 25 b5 00 00 00 07 00 00 00 01 .....;%.........
00000040: 00 00 0b fe 00 00 00 02 00 00 0c 20 00 00 13 e0 ........... ....
00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
XFS (loop6): Metadata CRC error detected at xfs_allocbt_read_verify+0x50/0x108 fs/xfs/libxfs/xfs_alloc_btree.c:338, xfs_bnobt block 0x4
XFS (loop6): Unmount and run xfs_repair
XFS (loop6): First 128 bytes of corrupted metadata buffer:
00000000: 41 42 33 42 00 00 00 03 ff ff ff ff ff ff ff ff AB3B............
00000010: 00 00 00 00 00 00 00 04 00 00 00 01 00 00 00 10 ................
00000020: ed 37 bf 6e 74 ea 4e 01 f8 ba 5f ee 27 4b 0f 3a .7.nt.N..._.'K.:
00000030: 00 00 00 00 f6 3b 25 b5 00 00 00 07 00 00 00 01 .....;%.........
00000040: 00 00 0b fe 00 00 00 02 00 00 0c 20 00 00 13 e0 ........... ....
00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................


---
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 syzk...@googlegroups.com.

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,
Apr 9, 2025, 1:47:18 PM4/9/25
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages