[moderation] [gfs2?] KASAN: slab-use-after-free Read in do_xmote

0 views
Skip to first unread message

syzbot

unread,
Jun 10, 2024, 2:27:27 PMJun 10
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 2df0193e62cf Merge tag 'thermal-6.10-rc3' of git://git.ker..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1785c1ac980000
kernel config: https://syzkaller.appspot.com/x/.config?x=96fd46a1ee1615e0
dashboard link: https://syzkaller.appspot.com/bug?extid=04b456c87326d2f56407
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: i386
CC: [agru...@redhat.com gf...@lists.linux.dev linux-...@vger.kernel.org]

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

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7bc7510fe41f/non_bootable_disk-2df0193e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/e2c56f736419/vmlinux-2df0193e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/d7699114b139/bzImage-2df0193e.xz

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

==================================================================
BUG: KASAN: slab-use-after-free in is_system_glock fs/gfs2/glock.c:699 [inline]
BUG: KASAN: slab-use-after-free in do_xmote+0xd88/0xe20 fs/gfs2/glock.c:814
Read of size 8 at addr ffff888000ae04b8 by task kworker/0:0H/9

CPU: 0 PID: 9 Comm: kworker/0:0H Not tainted 6.10.0-rc2-syzkaller-00097-g2df0193e62cf #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Workqueue: glock_workqueue glock_work_func
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114
print_address_description mm/kasan/report.c:377 [inline]
print_report+0xc3/0x620 mm/kasan/report.c:488
kasan_report+0xd9/0x110 mm/kasan/report.c:601
is_system_glock fs/gfs2/glock.c:699 [inline]
do_xmote+0xd88/0xe20 fs/gfs2/glock.c:814
run_queue+0x3f0/0x6b0 fs/gfs2/glock.c:900
glock_work_func+0x127/0x3e0 fs/gfs2/glock.c:1133
process_one_work+0x958/0x1ad0 kernel/workqueue.c:3231
process_scheduled_works kernel/workqueue.c:3312 [inline]
worker_thread+0x6c8/0xf70 kernel/workqueue.c:3393
kthread+0x2c1/0x3a0 kernel/kthread.c:389
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
</TASK>

Allocated by task 5361:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
unpoison_slab_object mm/kasan/common.c:312 [inline]
__kasan_slab_alloc+0x89/0x90 mm/kasan/common.c:338
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook mm/slub.c:3940 [inline]
slab_alloc_node mm/slub.c:4000 [inline]
kmem_cache_alloc_lru_noprof+0x121/0x2f0 mm/slub.c:4019
gfs2_alloc_inode+0x49/0x1f0 fs/gfs2/super.c:1537
alloc_inode+0x5d/0x230 fs/inode.c:261
iget5_locked fs/inode.c:1235 [inline]
iget5_locked+0x1c9/0x2c0 fs/inode.c:1228
gfs2_inode_lookup+0xd1/0x8a0 fs/gfs2/inode.c:124
gfs2_dir_search+0x22c/0x2e0 fs/gfs2/dir.c:1667
gfs2_lookupi+0x3c5/0x6d0 fs/gfs2/inode.c:340
gfs2_lookup_meta+0xa8/0x180 fs/gfs2/inode.c:280
init_statfs fs/gfs2/ops_fstype.c:631 [inline]
init_journal fs/gfs2/ops_fstype.c:797 [inline]
init_inodes+0xf60/0x2e80 fs/gfs2/ops_fstype.c:865
gfs2_fill_super+0x1a6e/0x2b60 fs/gfs2/ops_fstype.c:1244
get_tree_bdev+0x36f/0x610 fs/super.c:1615
gfs2_get_tree+0x4e/0x280 fs/gfs2/ops_fstype.c:1322
vfs_get_tree+0x8f/0x380 fs/super.c:1780
do_new_mount fs/namespace.c:3352 [inline]
path_mount+0x6e1/0x1f10 fs/namespace.c:3679
do_mount fs/namespace.c:3692 [inline]
__do_sys_mount fs/namespace.c:3898 [inline]
__se_sys_mount fs/namespace.c:3875 [inline]
__ia32_sys_mount+0x295/0x320 fs/namespace.c:3875
do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
__do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386
do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411
entry_SYSENTER_compat_after_hwframe+0x84/0x8e

Freed by task 24:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579
poison_slab_object+0xf7/0x160 mm/kasan/common.c:240
__kasan_slab_free+0x32/0x50 mm/kasan/common.c:256
kasan_slab_free include/linux/kasan.h:184 [inline]
slab_free_hook mm/slub.c:2195 [inline]
slab_free mm/slub.c:4436 [inline]
kmem_cache_free+0x12f/0x3a0 mm/slub.c:4511
i_callback+0x43/0x70 fs/inode.c:250
rcu_do_batch kernel/rcu/tree.c:2535 [inline]
rcu_core+0x828/0x16b0 kernel/rcu/tree.c:2809
handle_softirqs+0x216/0x8f0 kernel/softirq.c:554
run_ksoftirqd kernel/softirq.c:928 [inline]
run_ksoftirqd+0x3a/0x60 kernel/softirq.c:920
smpboot_thread_fn+0x661/0xa10 kernel/smpboot.c:164
kthread+0x2c1/0x3a0 kernel/kthread.c:389
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Last potentially related work creation:
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
__kasan_record_aux_stack+0xba/0xd0 mm/kasan/generic.c:541
__call_rcu_common.constprop.0+0x9a/0x790 kernel/rcu/tree.c:3072
destroy_inode+0x12c/0x1b0 fs/inode.c:316
iput_final fs/inode.c:1741 [inline]
iput.part.0+0x5a8/0x7f0 fs/inode.c:1767
iput+0x5c/0x80 fs/inode.c:1757
gfs2_put_super+0x258/0x750 fs/gfs2/super.c:627
generic_shutdown_super+0x159/0x3d0 fs/super.c:642
kill_block_super+0x3b/0x90 fs/super.c:1676
gfs2_kill_sb+0x360/0x410 fs/gfs2/ops_fstype.c:1785
deactivate_locked_super+0xbe/0x1a0 fs/super.c:473
deactivate_super+0xde/0x100 fs/super.c:506
cleanup_mnt+0x222/0x450 fs/namespace.c:1267
task_work_run+0x14e/0x250 kernel/task_work.c:180
exit_task_work include/linux/task_work.h:38 [inline]
do_exit+0xa9b/0x2ba0 kernel/exit.c:874
do_group_exit+0xd3/0x2a0 kernel/exit.c:1023
__do_sys_exit_group kernel/exit.c:1034 [inline]
__se_sys_exit_group kernel/exit.c:1032 [inline]
__ia32_sys_exit_group+0x3e/0x50 kernel/exit.c:1032
do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
__do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386
do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411
entry_SYSENTER_compat_after_hwframe+0x84/0x8e

The buggy address belongs to the object at ffff888000ae0000
which belongs to the cache gfs2_inode of size 1592
The buggy address is located 1208 bytes inside of
freed 1592-byte region [ffff888000ae0000, ffff888000ae0638)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888000ae2198 pfn:0xae0
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff8880216c5a01
flags: 0x7ff00000000040(head|node=0|zone=0|lastcpupid=0x7ff)
page_type: 0xffffefff(slab)
raw: 007ff00000000040 ffff888016f67e00 dead000000000122 0000000000000000
raw: ffff888000ae2198 0000000080130011 00000001ffffefff ffff8880216c5a01
head: 007ff00000000040 ffff888016f67e00 dead000000000122 0000000000000000
head: ffff888000ae2198 0000000080130011 00000001ffffefff ffff8880216c5a01
head: 007ff00000000003 ffffea000002b801 ffffffffffffffff 0000000000000000
head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Reclaimable, gfp_mask 0x1d20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 5361, tgid 5360 (syz-executor.0), ts 57514593072, free_ts 57494276425
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1468
prep_new_page mm/page_alloc.c:1476 [inline]
get_page_from_freelist+0x136a/0x2df0 mm/page_alloc.c:3402
__alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4660
__alloc_pages_node_noprof include/linux/gfp.h:269 [inline]
alloc_pages_node_noprof include/linux/gfp.h:296 [inline]
alloc_slab_page+0x56/0x110 mm/slub.c:2264
allocate_slab mm/slub.c:2427 [inline]
new_slab+0x84/0x260 mm/slub.c:2480
___slab_alloc+0xdac/0x1870 mm/slub.c:3666
__slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3756
__slab_alloc_node mm/slub.c:3809 [inline]
slab_alloc_node mm/slub.c:3988 [inline]
kmem_cache_alloc_lru_noprof+0x2a7/0x2f0 mm/slub.c:4019
gfs2_alloc_inode+0x49/0x1f0 fs/gfs2/super.c:1537
alloc_inode+0x5d/0x230 fs/inode.c:261
iget5_locked fs/inode.c:1235 [inline]
iget5_locked+0x1c9/0x2c0 fs/inode.c:1228
gfs2_inode_lookup+0xd1/0x8a0 fs/gfs2/inode.c:124
gfs2_dir_search+0x22c/0x2e0 fs/gfs2/dir.c:1667
gfs2_lookupi+0x3c5/0x6d0 fs/gfs2/inode.c:340
gfs2_lookup_meta+0xa8/0x180 fs/gfs2/inode.c:280
init_statfs fs/gfs2/ops_fstype.c:631 [inline]
init_journal fs/gfs2/ops_fstype.c:797 [inline]
init_inodes+0xf60/0x2e80 fs/gfs2/ops_fstype.c:865
page last free pid 111 tgid 111 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1088 [inline]
free_unref_folios+0x991/0x1310 mm/page_alloc.c:2614
shrink_folio_list+0x348a/0x4150 mm/vmscan.c:1446
evict_folios+0x6e6/0x1bf0 mm/vmscan.c:4553
try_to_shrink_lruvec+0x618/0x9b0 mm/vmscan.c:4749
shrink_one+0x3f8/0x7c0 mm/vmscan.c:4788
shrink_many mm/vmscan.c:4851 [inline]
lru_gen_shrink_node+0x89f/0x1750 mm/vmscan.c:4951
shrink_node mm/vmscan.c:5910 [inline]
kswapd_shrink_node mm/vmscan.c:6720 [inline]
balance_pgdat+0x1105/0x1970 mm/vmscan.c:6911
kswapd+0x5ea/0xbf0 mm/vmscan.c:7180
kthread+0x2c1/0x3a0 kernel/kthread.c:389
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Memory state around the buggy address:
ffff888000ae0380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888000ae0400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888000ae0480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888000ae0500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888000ae0580: fb fb fb fb fb fb fb fb 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 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
Reply all
Reply to author
Forward
0 new messages