syzbot


KASAN: slab-use-after-free Read in gfs2_glock_free

Status: auto-obsoleted due to no activity on 2024/09/10 23:20
Subsystems: gfs2
[Documentation on labels]
Reported-by: syzbot+6169a526172f97942e95@syzkaller.appspotmail.com
First crash: 226d, last: 178d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in gfs2_glock_free gfs2 1 659d 659d 0/28 auto-obsoleted due to no activity on 2023/05/19 07:29

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in register_lock_class+0xdab/0x1230 kernel/locking/lockdep.c:1328
Read of size 8 at addr ffff88804dfec530 by task kworker/2:1H/1224

CPU: 2 PID: 1224 Comm: kworker/2:1H Not tainted 6.10.0-rc3-syzkaller-00022-gcea2a26553ac #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
 register_lock_class+0xdab/0x1230 kernel/locking/lockdep.c:1328
 __lock_acquire+0x111/0x3b30 kernel/locking/lockdep.c:5014
 lock_acquire kernel/locking/lockdep.c:5754 [inline]
 lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5719
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162
 __wake_up_common_lock kernel/sched/wait.c:105 [inline]
 __wake_up+0x1c/0x60 kernel/sched/wait.c:127
 gfs2_glock_free+0x81/0x90 fs/gfs2/glock.c:182
 glock_work_func+0x2e6/0x3e0 fs/gfs2/glock.c:1149
 process_one_work+0x9fb/0x1b60 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 5818:
 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 poison_kmalloc_redzone mm/kasan/common.c:370 [inline]
 __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:387
 kmalloc_noprof include/linux/slab.h:660 [inline]
 kzalloc_noprof include/linux/slab.h:778 [inline]
 init_sbd fs/gfs2/ops_fstype.c:77 [inline]
 gfs2_fill_super+0x141/0x2c90 fs/gfs2/ops_fstype.c:1141
 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+0x14e6/0x1f20 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]
 __x64_sys_mount+0x297/0x320 fs/namespace.c:3875
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 5226:
 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:2196 [inline]
 slab_free mm/slub.c:4437 [inline]
 kfree+0x12a/0x3b0 mm/slub.c:4558
 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
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:114 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
 syscall_exit_to_user_mode+0x278/0x2a0 kernel/entry/common.c:218
 do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff88804dfec000
 which belongs to the cache kmalloc-8k of size 8192
The buggy address is located 1328 bytes inside of
 freed 8192-byte region [ffff88804dfec000, ffff88804dfee000)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4dfe8
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffefff(slab)
raw: 00fff00000000040 ffff888015443180 dead000000000122 0000000000000000
raw: 0000000000000000 0000000080020002 00000001ffffefff 0000000000000000
head: 00fff00000000040 ffff888015443180 dead000000000122 0000000000000000
head: 0000000000000000 0000000080020002 00000001ffffefff 0000000000000000
head: 00fff00000000003 ffffea000137fa01 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 Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5823, tgid 5821 (syz-executor.1), ts 170451874113, free_ts 170440712095
 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/0x2e50 mm/page_alloc.c:3420
 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4678
 __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:2265
 allocate_slab mm/slub.c:2428 [inline]
 new_slab+0x84/0x260 mm/slub.c:2481
 ___slab_alloc+0xdac/0x1870 mm/slub.c:3667
 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3757
 __slab_alloc_node mm/slub.c:3810 [inline]
 slab_alloc_node mm/slub.c:3989 [inline]
 __do_kmalloc_node mm/slub.c:4121 [inline]
 __kmalloc_noprof+0x36d/0x410 mm/slub.c:4135
 kmalloc_noprof include/linux/slab.h:664 [inline]
 kmalloc_array_noprof include/linux/slab.h:699 [inline]
 vhost_dev_alloc_iovecs drivers/vhost/vhost.c:473 [inline]
 vhost_dev_set_owner+0x21b/0xa70 drivers/vhost/vhost.c:934
 vhost_dev_ioctl+0x8e9/0xdb0 drivers/vhost/vhost.c:2108
 vhost_vsock_dev_ioctl+0x3b0/0xb50 drivers/vhost/vsock.c:875
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:907 [inline]
 __se_sys_ioctl fs/ioctl.c:893 [inline]
 __x64_sys_ioctl+0x193/0x220 fs/ioctl.c:893
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 1090 tgid 1090 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1088 [inline]
 free_unref_page+0x64a/0xe40 mm/page_alloc.c:2583
 __put_partials+0x14c/0x170 mm/slub.c:2995
 qlink_free mm/kasan/quarantine.c:163 [inline]
 qlist_free_all+0x4e/0x140 mm/kasan/quarantine.c:179
 kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286
 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:322
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook mm/slub.c:3941 [inline]
 slab_alloc_node mm/slub.c:4001 [inline]
 kmem_cache_alloc_node_noprof+0x153/0x310 mm/slub.c:4044
 __alloc_skb+0x2b1/0x380 net/core/skbuff.c:656
 alloc_skb include/linux/skbuff.h:1308 [inline]
 alloc_skb_with_frags+0xe4/0x710 net/core/skbuff.c:6504
 sock_alloc_send_pskb+0x7f1/0x980 net/core/sock.c:2794
 sock_alloc_send_skb include/net/sock.h:1773 [inline]
 mld_newpack.isra.0+0x1ed/0x790 net/ipv6/mcast.c:1746
 add_grhead+0x299/0x340 net/ipv6/mcast.c:1849
 add_grec+0x111e/0x1670 net/ipv6/mcast.c:1987
 mld_send_initial_cr.part.0+0xe2/0x260 net/ipv6/mcast.c:2233
 mld_send_initial_cr include/linux/refcount.h:192 [inline]
 ipv6_mc_dad_complete+0x22c/0x2b0 net/ipv6/mcast.c:2244
 addrconf_dad_completed+0xd42/0x1060 net/ipv6/addrconf.c:4339
 addrconf_dad_work+0x807/0x1500 net/ipv6/addrconf.c:4267

Memory state around the buggy address:
 ffff88804dfec400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88804dfec480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88804dfec500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                     ^
 ffff88804dfec580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88804dfec600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/06/12 23:19 upstream cea2a26553ac c2e07261 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in gfs2_glock_free
2024/04/26 21:23 upstream e6ebf0117218 07b455f9 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in gfs2_glock_free
* Struck through repros no longer work on HEAD.