syzbot


KASAN: slab-use-after-free Write in gfs2_qd_dealloc (3)

Status: upstream: reported on 2025/05/28 10:08
Subsystems: gfs2
[Documentation on labels]
Reported-by: syzbot+42a37bf8045847d8f9d2@syzkaller.appspotmail.com
First crash: 50d, last: 6d09h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [gfs2?] KASAN: slab-use-after-free Write in gfs2_qd_dealloc (3) 0 (1) 2025/05/28 10:08
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Write in gfs2_qd_dealloc (2) gfs2 syz 1 428d 428d 0/28 auto-obsoleted due to no activity on 2024/07/09 22:19
upstream KASAN: slab-use-after-free Write in gfs2_qd_dealloc gfs2 C inconclusive 27 559d 613d 25/28 fixed on 2023/12/21 03:45

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:96 [inline]
BUG: KASAN: slab-use-after-free in atomic_dec_and_test include/linux/atomic/atomic-instrumented.h:1383 [inline]
BUG: KASAN: slab-use-after-free in gfs2_qd_dealloc+0x81/0xe0 fs/gfs2/quota.c:112
Write of size 4 at addr ffff88807dd70a80 by task kworker/0:3/5828

CPU: 0 UID: 0 PID: 5828 Comm: kworker/0:3 Not tainted 6.15.0-syzkaller-02443-g015a99fa7665 #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Workqueue: wg-crypt-wg0 wg_packet_encrypt_worker
Call Trace:
 <IRQ>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:408 [inline]
 print_report+0xd2/0x2b0 mm/kasan/report.c:521
 kasan_report+0x118/0x150 mm/kasan/report.c:634
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x2b0/0x2c0 mm/kasan/generic.c:189
 instrument_atomic_read_write include/linux/instrumented.h:96 [inline]
 atomic_dec_and_test include/linux/atomic/atomic-instrumented.h:1383 [inline]
 gfs2_qd_dealloc+0x81/0xe0 fs/gfs2/quota.c:112
 rcu_do_batch kernel/rcu/tree.c:2576 [inline]
 rcu_core+0xca8/0x1710 kernel/rcu/tree.c:2832
 handle_softirqs+0x286/0x870 kernel/softirq.c:579
 __do_softirq kernel/softirq.c:613 [inline]
 invoke_softirq kernel/softirq.c:453 [inline]
 __irq_exit_rcu+0xca/0x1f0 kernel/softirq.c:680
 irq_exit_rcu+0x9/0x30 kernel/softirq.c:696
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1050 [inline]
 sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1050
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
RIP: 0010:queue_work_on+0x1f7/0x270 kernel/workqueue.c:2397
Code: 4d 85 ff 75 16 e8 c9 57 35 00 eb 15 e8 c2 57 35 00 e8 bd 58 d3 09 4d 85 ff 74 ea e8 b3 57 35 00 fb 48 c7 44 24 40 0e 36 e0 45 <4b> c7 04 2e 00 00 00 00 66 43 c7 44 2e 09 00 00 43 c6 44 2e 0b 00
RSP: 0018:ffffc900041bf3c0 EFLAGS: 00000293
RAX: ffffffff818a995d RBX: ffff8880661d1701 RCX: ffff88802897da00
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc900041bf4a8 R08: ffffffff8f9fc4b7 R09: 1ffffffff1f3f896
R10: dffffc0000000000 R11: fffffbfff1f3f897 R12: 0000000000000000
R13: dffffc0000000000 R14: 1ffff92000837e80 R15: 0000000000000200
 wg_queue_enqueue_per_peer_tx+0x1ef/0x460 drivers/net/wireguard/queueing.h:188
 wg_packet_encrypt_worker+0x135c/0x1720 drivers/net/wireguard/send.c:305
 process_one_work kernel/workqueue.c:3238 [inline]
 process_scheduled_works+0xade/0x17a0 kernel/workqueue.c:3319
 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3400
 kthread+0x711/0x8a0 kernel/kthread.c:464
 ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>

Allocated by task 6289:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:68
 poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
 __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:394
 kasan_kmalloc include/linux/kasan.h:260 [inline]
 __kmalloc_cache_noprof+0x230/0x3d0 mm/slub.c:4358
 kmalloc_noprof include/linux/slab.h:905 [inline]
 kzalloc_noprof include/linux/slab.h:1039 [inline]
 init_sbd fs/gfs2/ops_fstype.c:75 [inline]
 gfs2_fill_super+0x11b/0x2010 fs/gfs2/ops_fstype.c:1125
 get_tree_bdev_flags+0x40e/0x4d0 fs/super.c:1686
 gfs2_get_tree+0x51/0x1e0 fs/gfs2/ops_fstype.c:1333
 vfs_get_tree+0x92/0x2b0 fs/super.c:1809
 do_new_mount+0x24a/0xa40 fs/namespace.c:3882
 do_mount fs/namespace.c:4222 [inline]
 __do_sys_mount fs/namespace.c:4433 [inline]
 __se_sys_mount+0x317/0x410 fs/namespace.c:4410
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 6289:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:68
 kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:576
 poison_slab_object mm/kasan/common.c:247 [inline]
 __kasan_slab_free+0x62/0x70 mm/kasan/common.c:264
 kasan_slab_free include/linux/kasan.h:233 [inline]
 slab_free_hook mm/slub.c:2380 [inline]
 slab_free mm/slub.c:4642 [inline]
 kfree+0x18e/0x440 mm/slub.c:4841
 free_sbd fs/gfs2/ops_fstype.c:68 [inline]
 gfs2_fill_super+0x1445/0x2010 fs/gfs2/ops_fstype.c:1316
 get_tree_bdev_flags+0x40e/0x4d0 fs/super.c:1686
 gfs2_get_tree+0x51/0x1e0 fs/gfs2/ops_fstype.c:1333
 vfs_get_tree+0x92/0x2b0 fs/super.c:1809
 do_new_mount+0x24a/0xa40 fs/namespace.c:3882
 do_mount fs/namespace.c:4222 [inline]
 __do_sys_mount fs/namespace.c:4433 [inline]
 __se_sys_mount+0x317/0x410 fs/namespace.c:4410
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

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

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7dd70
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: f5(slab)
raw: 00fff00000000040 ffff88801a442280 dead000000000122 0000000000000000
raw: 0000000000000000 0000000080020002 00000000f5000000 0000000000000000
head: 00fff00000000040 ffff88801a442280 dead000000000122 0000000000000000
head: 0000000000000000 0000000080020002 00000000f5000000 0000000000000000
head: 00fff00000000003 ffffea0001f75c01 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 6289, tgid 6287 (syz.2.96), ts 155443646326, free_ts 155000585614
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1714
 prep_new_page mm/page_alloc.c:1722 [inline]
 get_page_from_freelist+0x21ce/0x22b0 mm/page_alloc.c:3684
 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:4974
 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2301
 alloc_slab_page mm/slub.c:2450 [inline]
 allocate_slab+0x8a/0x3b0 mm/slub.c:2618
 new_slab mm/slub.c:2672 [inline]
 ___slab_alloc+0xbfc/0x1480 mm/slub.c:3858
 __slab_alloc mm/slub.c:3948 [inline]
 __slab_alloc_node mm/slub.c:4023 [inline]
 slab_alloc_node mm/slub.c:4184 [inline]
 __kmalloc_cache_noprof+0x296/0x3d0 mm/slub.c:4353
 kmalloc_noprof include/linux/slab.h:905 [inline]
 kzalloc_noprof include/linux/slab.h:1039 [inline]
 init_sbd fs/gfs2/ops_fstype.c:75 [inline]
 gfs2_fill_super+0x11b/0x2010 fs/gfs2/ops_fstype.c:1125
 get_tree_bdev_flags+0x40e/0x4d0 fs/super.c:1686
 gfs2_get_tree+0x51/0x1e0 fs/gfs2/ops_fstype.c:1333
 vfs_get_tree+0x92/0x2b0 fs/super.c:1809
 do_new_mount+0x24a/0xa40 fs/namespace.c:3882
 do_mount fs/namespace.c:4222 [inline]
 __do_sys_mount fs/namespace.c:4433 [inline]
 __se_sys_mount+0x317/0x410 fs/namespace.c:4410
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 6277 tgid 6275 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1258 [inline]
 __free_frozen_pages+0xc68/0xe50 mm/page_alloc.c:2721
 discard_slab mm/slub.c:2716 [inline]
 __put_partials+0x161/0x1c0 mm/slub.c:3185
 put_cpu_partial+0x17c/0x250 mm/slub.c:3260
 __slab_free+0x2f7/0x400 mm/slub.c:4512
 qlink_free mm/kasan/quarantine.c:163 [inline]
 qlist_free_all+0x97/0x140 mm/kasan/quarantine.c:179
 kasan_quarantine_reduce+0x148/0x160 mm/kasan/quarantine.c:286
 __kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:329
 kasan_slab_alloc include/linux/kasan.h:250 [inline]
 slab_post_alloc_hook mm/slub.c:4147 [inline]
 slab_alloc_node mm/slub.c:4196 [inline]
 kmem_cache_alloc_noprof+0x1c1/0x3c0 mm/slub.c:4203
 __kernfs_new_node+0xd7/0x7f0 fs/kernfs/dir.c:637
 kernfs_new_node+0x102/0x210 fs/kernfs/dir.c:713
 __kernfs_create_file+0x4b/0x2e0 fs/kernfs/file.c:1038
 sysfs_add_file_mode_ns+0x238/0x300 fs/sysfs/file.c:319
 create_files fs/sysfs/group.c:76 [inline]
 internal_create_group+0x66d/0x1110 fs/sysfs/group.c:183
 internal_create_groups fs/sysfs/group.c:223 [inline]
 sysfs_create_groups+0x59/0x120 fs/sysfs/group.c:249
 device_add_groups drivers/base/core.c:2839 [inline]
 device_add_attrs+0x1c4/0x5a0 drivers/base/core.c:2914
 device_add+0x496/0xb50 drivers/base/core.c:3646

Memory state around the buggy address:
 ffff88807dd70980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88807dd70a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88807dd70a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88807dd70b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88807dd70b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
   0:	4d 85 ff             	test   %r15,%r15
   3:	75 16                	jne    0x1b
   5:	e8 c9 57 35 00       	call   0x3557d3
   a:	eb 15                	jmp    0x21
   c:	e8 c2 57 35 00       	call   0x3557d3
  11:	e8 bd 58 d3 09       	call   0x9d358d3
  16:	4d 85 ff             	test   %r15,%r15
  19:	74 ea                	je     0x5
  1b:	e8 b3 57 35 00       	call   0x3557d3
  20:	fb                   	sti
  21:	48 c7 44 24 40 0e 36 	movq   $0x45e0360e,0x40(%rsp)
  28:	e0 45
* 2a:	4b c7 04 2e 00 00 00 	movq   $0x0,(%r14,%r13,1) <-- trapping instruction
  31:	00
  32:	66 43 c7 44 2e 09 00 	movw   $0x0,0x9(%r14,%r13,1)
  39:	00
  3a:	43 c6 44 2e 0b 00    	movb   $0x0,0xb(%r14,%r13,1)

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/05/28 11:34 upstream 015a99fa7665 874a1386 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root KASAN: slab-use-after-free Write in gfs2_qd_dealloc
2025/04/14 00:31 linux-next 01c6df60d5d4 0bd6db41 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Write in gfs2_qd_dealloc
* Struck through repros no longer work on HEAD.