syzbot


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

Status: upstream: reported C repro on 2025/05/28 10:08
Subsystems: gfs2
[Documentation on labels]
Reported-by: syzbot+42a37bf8045847d8f9d2@syzkaller.appspotmail.com
First crash: 130d, last: 5d21h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [gfs2?] KASAN: slab-use-after-free Write in gfs2_qd_dealloc (3) 2 (5) 2025/07/24 12:11
Similar bugs (3)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Write in gfs2_qd_dealloc (2) gfs2 24 syz 1 508d 507d 0/29 auto-obsoleted due to no activity on 2024/07/09 22:19
upstream KASAN: slab-use-after-free Write in gfs2_qd_dealloc gfs2 24 C inconclusive 27 639d 692d 25/29 fixed on 2023/12/21 03:45
linux-6.6 KASAN: slab-use-after-free Write in gfs2_qd_dealloc origin:lts-only 24 C done 4 20d 23d 0/2 upstream: reported C repro on 2025/07/29 13:42
Last patch testing requests (2)
Created Duration User Patch Repo Result
2025/08/11 22:30 20m retest repro upstream OK log
2025/07/24 11:38 17m anprice@redhat.com patch upstream report log

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+0x7a/0xf0 fs/gfs2/quota.c:112
Write of size 4 at addr ffff888022e84a80 by task syz.6.2619/18317

CPU: 1 UID: 0 PID: 18317 Comm: syz.6.2619 Not tainted 6.16.0-rc7-syzkaller-00120-g5f33ebd2018c #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:378 [inline]
 print_report+0xcd/0x630 mm/kasan/report.c:482
 kasan_report+0xe0/0x110 mm/kasan/report.c:595
 check_region_inline mm/kasan/generic.c:183 [inline]
 kasan_check_range+0x100/0x1b0 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+0x7a/0xf0 fs/gfs2/quota.c:112
 rcu_do_batch kernel/rcu/tree.c:2576 [inline]
 rcu_core+0x79c/0x14e0 kernel/rcu/tree.c:2832
 handle_softirqs+0x219/0x8e0 kernel/softirq.c:579
 __do_softirq kernel/softirq.c:613 [inline]
 invoke_softirq kernel/softirq.c:453 [inline]
 __irq_exit_rcu+0x109/0x170 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+0xa4/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:__raw_spin_unlock_irq include/linux/spinlock_api_smp.h:160 [inline]
RIP: 0010:_raw_spin_unlock_irq+0x29/0x50 kernel/locking/spinlock.c:202
Code: 90 f3 0f 1e fa 53 48 8b 74 24 08 48 89 fb 48 83 c7 18 e8 2a dd 11 f6 48 89 df e8 12 31 12 f6 e8 6d 12 3d f6 fb bf 01 00 00 00 <e8> 82 53 02 f6 65 8b 05 fb e9 48 08 85 c0 74 06 5b e9 cc 9a 89 f5
RSP: 0018:ffffc9000b31f6f8 EFLAGS: 00000202
RAX: 0000000000010fb5 RBX: ffff888025433160 RCX: 0000000000000006
RDX: 0000000000000000 RSI: ffffffff8de2bcfa RDI: 0000000000000001
RBP: ffff888025433158 R08: 0000000000000001 R09: 0000000000000001
R10: ffffffff90a95f57 R11: 0000000000000001 R12: ffff888025433160
R13: ffff888025433158 R14: ffffc9000b31f970 R15: 0000000000000006
 spin_unlock_irq include/linux/spinlock.h:401 [inline]
 filemap_remove_folio+0x106/0x250 mm/filemap.c:254
 truncate_inode_folio+0x49/0x70 mm/truncate.c:176
 shmem_undo_range+0x376/0x1150 mm/shmem.c:1121
 shmem_truncate_range mm/shmem.c:1237 [inline]
 shmem_evict_inode+0x3a1/0xbe0 mm/shmem.c:1365
 evict+0x3e6/0x920 fs/inode.c:810
 iput_final fs/inode.c:1898 [inline]
 iput fs/inode.c:1924 [inline]
 iput+0x521/0x880 fs/inode.c:1910
 dentry_unlink_inode+0x29c/0x480 fs/dcache.c:466
 __dentry_kill+0x1d0/0x600 fs/dcache.c:669
 dput.part.0+0x4b1/0x9b0 fs/dcache.c:911
 dput+0x1f/0x30 fs/dcache.c:901
 __fput+0x51c/0xb70 fs/file_table.c:473
 task_work_run+0x150/0x240 kernel/task_work.c:227
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 exit_to_user_mode_loop+0xeb/0x110 kernel/entry/common.c:114
 exit_to_user_mode_prepare include/linux/entry-common.h:330 [inline]
 syscall_exit_to_user_mode_work include/linux/entry-common.h:414 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:449 [inline]
 do_syscall_64+0x3f6/0x4c0 arch/x86/entry/syscall_64.c:100
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc45478d60a
Code: 48 3d 00 f0 ff ff 77 48 c3 0f 1f 80 00 00 00 00 48 83 ec 18 89 7c 24 0c e8 43 91 02 00 8b 7c 24 0c 89 c2 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 36 89 d7 89 44 24 0c e8 a3 91 02 00 8b 44 24
RSP: 002b:00007fc45550ee50 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: ffffffffffffffff RCX: 00007fc45478d60a
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000084
R10: 0000000000000000 R11: 0000000000000293 R12: 000000000000001c
R13: 00007fc45550eeb0 R14: 000000000001f791 R15: 0000200000000000
 </TASK>

Allocated by task 18317:
 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:377 [inline]
 __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394
 kmalloc_noprof include/linux/slab.h:905 [inline]
 kzalloc_noprof include/linux/slab.h:1039 [inline]
 init_sbd fs/gfs2/ops_fstype.c:78 [inline]
 gfs2_fill_super+0x140/0x2d60 fs/gfs2/ops_fstype.c:1128
 get_tree_bdev_flags+0x38c/0x620 fs/super.c:1681
 gfs2_get_tree+0x4e/0x280 fs/gfs2/ops_fstype.c:1335
 vfs_get_tree+0x8e/0x340 fs/super.c:1804
 do_new_mount fs/namespace.c:3902 [inline]
 path_mount+0x1414/0x2020 fs/namespace.c:4226
 do_mount fs/namespace.c:4239 [inline]
 __do_sys_mount fs/namespace.c:4450 [inline]
 __se_sys_mount fs/namespace.c:4427 [inline]
 __x64_sys_mount+0x28d/0x310 fs/namespace.c:4427
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 18317:
 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:576
 poison_slab_object mm/kasan/common.c:247 [inline]
 __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264
 kasan_slab_free include/linux/kasan.h:233 [inline]
 slab_free_hook mm/slub.c:2381 [inline]
 slab_free mm/slub.c:4643 [inline]
 kfree+0x2b4/0x4d0 mm/slub.c:4842
 free_sbd fs/gfs2/ops_fstype.c:71 [inline]
 gfs2_fill_super+0x1575/0x2d60 fs/gfs2/ops_fstype.c:1319
 get_tree_bdev_flags+0x38c/0x620 fs/super.c:1681
 gfs2_get_tree+0x4e/0x280 fs/gfs2/ops_fstype.c:1335
 vfs_get_tree+0x8e/0x340 fs/super.c:1804
 do_new_mount fs/namespace.c:3902 [inline]
 path_mount+0x1414/0x2020 fs/namespace.c:4226
 do_mount fs/namespace.c:4239 [inline]
 __do_sys_mount fs/namespace.c:4450 [inline]
 __se_sys_mount fs/namespace.c:4427 [inline]
 __x64_sys_mount+0x28d/0x310 fs/namespace.c:4427
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

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

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x22e80
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
ksm flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff88801b842280 ffffea0002459e00 0000000000000003
raw: 0000000000000000 0000000080020002 00000000f5000000 0000000000000000
head: 00fff00000000040 ffff88801b842280 ffffea0002459e00 0000000000000003
head: 0000000000000000 0000000080020002 00000000f5000000 0000000000000000
head: 00fff00000000003 ffffea00008ba001 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 17204, tgid 17201 (syz.3.2388), ts 1377954240152, free_ts 1376993850231
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1c0/0x230 mm/page_alloc.c:1704
 prep_new_page mm/page_alloc.c:1712 [inline]
 get_page_from_freelist+0x1321/0x3890 mm/page_alloc.c:3669
 __alloc_frozen_pages_noprof+0x261/0x23f0 mm/page_alloc.c:4959
 alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2419
 alloc_slab_page mm/slub.c:2451 [inline]
 allocate_slab mm/slub.c:2619 [inline]
 new_slab+0x23b/0x330 mm/slub.c:2673
 ___slab_alloc+0xd9c/0x1940 mm/slub.c:3859
 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3949
 __slab_alloc_node mm/slub.c:4024 [inline]
 slab_alloc_node mm/slub.c:4185 [inline]
 __do_kmalloc_node mm/slub.c:4327 [inline]
 __kmalloc_node_track_caller_noprof+0x2ee/0x510 mm/slub.c:4347
 __do_krealloc mm/slub.c:4905 [inline]
 krealloc_noprof+0x1fc/0x370 mm/slub.c:4958
 copy_array.constprop.0+0x88/0x110 kernel/bpf/verifier.c:1381
 copy_stack_state kernel/bpf/verifier.c:1441 [inline]
 copy_func_state kernel/bpf/verifier.c:1727 [inline]
 copy_verifier_state kernel/bpf/verifier.c:1768 [inline]
 copy_verifier_state+0xaa3/0xfa0 kernel/bpf/verifier.c:1730
 is_state_visited kernel/bpf/verifier.c:19300 [inline]
 do_check kernel/bpf/verifier.c:19462 [inline]
 do_check_common+0x541e/0xc0e0 kernel/bpf/verifier.c:22807
 do_check_main kernel/bpf/verifier.c:22898 [inline]
 bpf_check+0x7f5e/0xb4f0 kernel/bpf/verifier.c:24064
 bpf_prog_load+0xe41/0x2490 kernel/bpf/syscall.c:2972
 __sys_bpf+0x4d1a/0x4ea0 kernel/bpf/syscall.c:5836
 __do_sys_bpf kernel/bpf/syscall.c:5943 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5941 [inline]
 __x64_sys_bpf+0x78/0xc0 kernel/bpf/syscall.c:5941
page last free pid 6269 tgid 6269 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1248 [inline]
 __free_frozen_pages+0x7fe/0x1180 mm/page_alloc.c:2706
 page_frag_free+0x27f/0x2e0 mm/page_frag_cache.c:169
 skb_free_frag include/linux/skbuff.h:3449 [inline]
 skb_free_head+0xa4/0x210 net/core/skbuff.c:1058
 skb_release_data+0x776/0x9c0 net/core/skbuff.c:1087
 skb_release_all net/core/skbuff.c:1152 [inline]
 __kfree_skb net/core/skbuff.c:1166 [inline]
 consume_skb net/core/skbuff.c:1398 [inline]
 consume_skb+0xbf/0x100 net/core/skbuff.c:1392
 batadv_forw_packet_free+0x217/0x250 net/batman-adv/send.c:473
 batadv_iv_send_outstanding_bat_ogm_packet+0x26d/0x920 net/batman-adv/bat_iv_ogm.c:1726
 process_one_work+0x9cf/0x1b70 kernel/workqueue.c:3238
 process_scheduled_works kernel/workqueue.c:3321 [inline]
 worker_thread+0x6c8/0xf10 kernel/workqueue.c:3402
 kthread+0x3c5/0x780 kernel/kthread.c:464
 ret_from_fork+0x5d7/0x6f0 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

Memory state around the buggy address:
 ffff888022e84980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888022e84a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888022e84a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff888022e84b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888022e84b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
   0:	90                   	nop
   1:	f3 0f 1e fa          	endbr64
   5:	53                   	push   %rbx
   6:	48 8b 74 24 08       	mov    0x8(%rsp),%rsi
   b:	48 89 fb             	mov    %rdi,%rbx
   e:	48 83 c7 18          	add    $0x18,%rdi
  12:	e8 2a dd 11 f6       	call   0xf611dd41
  17:	48 89 df             	mov    %rbx,%rdi
  1a:	e8 12 31 12 f6       	call   0xf6123131
  1f:	e8 6d 12 3d f6       	call   0xf63d1291
  24:	fb                   	sti
  25:	bf 01 00 00 00       	mov    $0x1,%edi
* 2a:	e8 82 53 02 f6       	call   0xf60253b1 <-- trapping instruction
  2f:	65 8b 05 fb e9 48 08 	mov    %gs:0x848e9fb(%rip),%eax        # 0x848ea31
  36:	85 c0                	test   %eax,%eax
  38:	74 06                	je     0x40
  3a:	5b                   	pop    %rbx
  3b:	e9 cc 9a 89 f5       	jmp    0xf5899b0c

Crashes (17):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/07/26 15:35 upstream 5f33ebd2018c fb8f743d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root KASAN: slab-use-after-free Write in gfs2_qd_dealloc
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/07/28 22:10 upstream 038d61fd6422 6654ea9c .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-use-after-free Write in gfs2_qd_dealloc
2025/07/28 04:24 upstream b711733e89a3 fb8f743d .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-use-after-free Write in gfs2_qd_dealloc
2025/07/27 03:47 upstream 302f88ff3584 fb8f743d .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-use-after-free Write in gfs2_qd_dealloc
2025/07/26 14:19 upstream 5f33ebd2018c fb8f743d .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-use-after-free Write in gfs2_qd_dealloc
2025/07/26 08:54 upstream 5f33ebd2018c fb8f743d .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-use-after-free Write in gfs2_qd_dealloc
2025/07/25 23:36 upstream 2942242dde89 fb8f743d .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-use-after-free Write in gfs2_qd_dealloc
2025/07/25 17:37 upstream 2942242dde89 fb8f743d .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-use-after-free Write in gfs2_qd_dealloc
2025/07/24 08:53 upstream f9af7b5d9349 0c1d6ded .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-use-after-free Write in gfs2_qd_dealloc
2025/07/23 20:48 upstream 01a412d06bc5 e0b9ac93 .config console log report syz / log C [disk image (non-bootable)] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci-snapshot-upstream-root KASAN: slab-use-after-free Write in gfs2_qd_dealloc
2025/07/23 19:30 upstream 01a412d06bc5 e0b9ac93 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-use-after-free Write in gfs2_qd_dealloc
2025/07/22 06:05 upstream 89be9a83ccf1 1555463b .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-use-after-free Write in gfs2_qd_dealloc
2025/08/16 14:18 linux-next 931e46dcbc7e 1804e95e .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
2025/06/27 03:06 linux-next ecb259c4f70d 803ce19b .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
2025/06/08 23:25 linux-next 475c850a7fdd 4826c28e .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
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.