==================================================================
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:1375 [inline]
BUG: KASAN: slab-use-after-free in gfs2_qd_dealloc+0x83/0xf0 fs/gfs2/quota.c:115
Write of size 4 at addr ffff88807c5b8a78 by task syz-executor.4/13154
CPU: 0 PID: 13154 Comm: syz-executor.4 Not tainted 6.6.0-rc3-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:364 [inline]
print_report+0x163/0x540 mm/kasan/report.c:475
kasan_report+0x175/0x1b0 mm/kasan/report.c:588
kasan_check_range+0x27e/0x290 mm/kasan/generic.c:187
instrument_atomic_read_write include/linux/instrumented.h:96 [inline]
atomic_dec_and_test include/linux/atomic/atomic-instrumented.h:1375 [inline]
gfs2_qd_dealloc+0x83/0xf0 fs/gfs2/quota.c:115
rcu_do_batch kernel/rcu/tree.c:2139 [inline]
rcu_core+0xacf/0x1790 kernel/rcu/tree.c:2403
__do_softirq+0x2ab/0x908 kernel/softirq.c:553
invoke_softirq kernel/softirq.c:427 [inline]
__irq_exit_rcu+0xf1/0x1b0 kernel/softirq.c:632
irq_exit_rcu+0x9/0x20 kernel/softirq.c:644
sysvec_call_function_single+0x92/0xb0 arch/x86/kernel/smp.c:287
asm_sysvec_call_function_single+0x1a/0x20 arch/x86/include/asm/idtentry.h:652
RIP: 0010:debug_lockdep_rcu_enabled+0x2c/0x30 kernel/rcu/update.c:319
Code: 1e fa 31 c0 83 3d 0f 37 cd 03 00 74 1d 83 3d 76 6a cd 03 00 74 14 65 48 8b 0d 60 75 36 75 31 c0 83 b9 c4 0a 00 00 00 0f 94 c0 0f 1f 00 66 0f 1f 00 48 8b 3c 24 e8 43 fb ff ff 66 90 66 90 e9
RSP: 0018:ffffc900152f7678 EFLAGS: 00000246
RAX: 0000000000000001 RBX: 0000000000000000 RCX: ffff88801e591dc0
RDX: 0000000000000000 RSI: 0000000000000132 RDI: ffffffff8caa96b5
RBP: ffffc900152f77a0 R08: ffffffff8e9a792f R09: 1ffffffff1d34f25
R10: dffffc0000000000 R11: fffffbfff1d34f26 R12: 0000000000000000
R13: ffff888012841640 R14: 0000000000000132 R15: 1ffff92002a5eed8
__might_resched+0x90/0x780 kernel/sched/core.c:10149
might_alloc include/linux/sched/mm.h:306 [inline]
slab_pre_alloc_hook+0x4a/0x310 mm/slab.h:709
slab_alloc_node mm/slub.c:3460 [inline]
__kmem_cache_alloc_node+0x4b/0x270 mm/slub.c:3517
__do_kmalloc_node mm/slab_common.c:1022 [inline]
__kmalloc_node+0xa7/0x230 mm/slab_common.c:1030
kmalloc_node include/linux/slab.h:619 [inline]
kvmalloc_node+0x72/0x180 mm/util.c:607
init_free_nid_cache fs/f2fs/node.c:3282 [inline]
f2fs_build_node_manager+0x1009/0x1e40 fs/f2fs/node.c:3315
f2fs_fill_super+0x5733/0x80e0 fs/f2fs/super.c:4568
mount_bdev+0x237/0x300 fs/super.c:1629
legacy_get_tree+0xef/0x190 fs/fs_context.c:638
vfs_get_tree+0x8c/0x280 fs/super.c:1750
do_new_mount+0x28f/0xae0 fs/namespace.c:3335
do_mount fs/namespace.c:3675 [inline]
__do_sys_mount fs/namespace.c:3884 [inline]
__se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3861
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f95ecc7e1ea
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 09 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f95eda99ee8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f95eda99f80 RCX: 00007f95ecc7e1ea
RDX: 0000000020000040 RSI: 0000000020000080 RDI: 00007f95eda99f40
RBP: 0000000020000040 R08: 00007f95eda99f80 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000020000080
R13: 00007f95eda99f40 R14: 00000000000054e6 R15: 0000000020000000
Allocated by task 13146:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4f/0x70 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:383
kmalloc include/linux/slab.h:599 [inline]
kzalloc include/linux/slab.h:720 [inline]
init_sbd fs/gfs2/ops_fstype.c:77 [inline]
gfs2_fill_super+0x136/0x26c0 fs/gfs2/ops_fstype.c:1164
get_tree_bdev+0x416/0x5b0 fs/super.c:1577
gfs2_get_tree+0x54/0x210 fs/gfs2/ops_fstype.c:1348
vfs_get_tree+0x8c/0x280 fs/super.c:1750
do_new_mount+0x28f/0xae0 fs/namespace.c:3335
do_mount fs/namespace.c:3675 [inline]
__do_sys_mount fs/namespace.c:3884 [inline]
__se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3861
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Freed by task 5060:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4f/0x70 mm/kasan/common.c:52
kasan_save_free_info+0x28/0x40 mm/kasan/generic.c:522
____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
kasan_slab_free include/linux/kasan.h:164 [inline]
slab_free_hook mm/slub.c:1800 [inline]
slab_free_freelist_hook mm/slub.c:1826 [inline]
slab_free mm/slub.c:3809 [inline]
__kmem_cache_free+0x25f/0x3b0 mm/slub.c:3822
generic_shutdown_super+0x13a/0x2c0 fs/super.c:693
kill_block_super+0x41/0x70 fs/super.c:1646
deactivate_locked_super+0xa4/0x110 fs/super.c:481
cleanup_mnt+0x426/0x4c0 fs/namespace.c:1254
task_work_run+0x24a/0x300 kernel/task_work.c:180
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0xde/0x100 kernel/entry/common.c:171
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204
__syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
syscall_exit_to_user_mode+0x64/0x280 kernel/entry/common.c:296
do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Last potentially related work creation:
kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45
__kasan_record_aux_stack+0xad/0xc0 mm/kasan/generic.c:492
insert_work+0x3e/0x320 kernel/workqueue.c:1647
__queue_work+0xc06/0x1010 kernel/workqueue.c:1799
queue_work_on+0x14f/0x250 kernel/workqueue.c:1834
queue_work include/linux/workqueue.h:554 [inline]
schedule_work include/linux/workqueue.h:615 [inline]
f2fs_handle_critical_error+0x7c8/0x9c0 fs/f2fs/super.c:4130
f2fs_write_end_io+0x7da/0xb00 fs/f2fs/data.c:366
__submit_merged_bio+0x28e/0x6c0 fs/f2fs/data.c:589
__f2fs_submit_merged_write fs/f2fs/data.c:682 [inline]
__submit_merged_write_cond fs/f2fs/data.c:704 [inline]
f2fs_submit_merged_write_cond+0x28a/0x360 fs/f2fs/data.c:721
f2fs_write_cache_pages fs/f2fs/data.c:3280 [inline]
__f2fs_write_data_pages fs/f2fs/data.c:3360 [inline]
f2fs_write_data_pages+0x2ff8/0x35f0 fs/f2fs/data.c:3387
do_writepages+0x3a6/0x670 mm/page-writeback.c:2553
filemap_fdatawrite_wbc+0x125/0x180 mm/filemap.c:390
__filemap_fdatawrite_range mm/filemap.c:423 [inline]
__filemap_fdatawrite mm/filemap.c:429 [inline]
filemap_fdatawrite+0x143/0x1b0 mm/filemap.c:434
f2fs_sync_dirty_inodes+0x337/0x840 fs/f2fs/checkpoint.c:1107
block_operations fs/f2fs/checkpoint.c:1240 [inline]
f2fs_write_checkpoint+0xb6a/0x1fa0 fs/f2fs/checkpoint.c:1648
kill_f2fs_super+0x250/0x3b0 fs/f2fs/super.c:4877
deactivate_locked_super+0xa4/0x110 fs/super.c:481
cleanup_mnt+0x426/0x4c0 fs/namespace.c:1254
task_work_run+0x24a/0x300 kernel/task_work.c:180
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0xde/0x100 kernel/entry/common.c:171
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204
__syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
syscall_exit_to_user_mode+0x64/0x280 kernel/entry/common.c:296
do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Second to last potentially related work creation:
kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45
__kasan_record_aux_stack+0xad/0xc0 mm/kasan/generic.c:492
insert_work+0x3e/0x320 kernel/workqueue.c:1647
__queue_work+0xc06/0x1010 kernel/workqueue.c:1799
queue_work_on+0x14f/0x250 kernel/workqueue.c:1834
queue_work include/linux/workqueue.h:554 [inline]
schedule_work include/linux/workqueue.h:615 [inline]
f2fs_handle_critical_error+0x7c8/0x9c0 fs/f2fs/super.c:4130
f2fs_write_end_io+0x7da/0xb00 fs/f2fs/data.c:366
__submit_merged_bio+0x28e/0x6c0 fs/f2fs/data.c:589
__f2fs_submit_merged_write fs/f2fs/data.c:682 [inline]
__submit_merged_write_cond fs/f2fs/data.c:704 [inline]
f2fs_submit_merged_write_cond+0x28a/0x360 fs/f2fs/data.c:721
f2fs_write_cache_pages fs/f2fs/data.c:3280 [inline]
__f2fs_write_data_pages fs/f2fs/data.c:3360 [inline]
f2fs_write_data_pages+0x2ff8/0x35f0 fs/f2fs/data.c:3387
do_writepages+0x3a6/0x670 mm/page-writeback.c:2553
filemap_fdatawrite_wbc+0x125/0x180 mm/filemap.c:390
__filemap_fdatawrite_range mm/filemap.c:423 [inline]
__filemap_fdatawrite mm/filemap.c:429 [inline]
filemap_fdatawrite+0x143/0x1b0 mm/filemap.c:434
f2fs_sync_dirty_inodes+0x337/0x840 fs/f2fs/checkpoint.c:1107
block_operations fs/f2fs/checkpoint.c:1240 [inline]
f2fs_write_checkpoint+0xb6a/0x1fa0 fs/f2fs/checkpoint.c:1648
kill_f2fs_super+0x250/0x3b0 fs/f2fs/super.c:4877
deactivate_locked_super+0xa4/0x110 fs/super.c:481
cleanup_mnt+0x426/0x4c0 fs/namespace.c:1254
task_work_run+0x24a/0x300 kernel/task_work.c:180
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0xde/0x100 kernel/entry/common.c:171
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204
__syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
syscall_exit_to_user_mode+0x64/0x280 kernel/entry/common.c:296
do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x63/0xcd
The buggy address belongs to the object at ffff88807c5b8000
which belongs to the cache kmalloc-8k of size 8192
The buggy address is located 2680 bytes inside of
freed 8192-byte region [ffff88807c5b8000, ffff88807c5ba000)
The buggy address belongs to the physical page:
page:ffffea0001f16e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7c5b8
head:ffffea0001f16e00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
ksm flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff888012842280 ffffea0000a88000 dead000000000003
raw: 0000000000000000 0000000000020002 00000001ffffffff 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5080, tgid 5080 (syz-executor.2), ts 161569304252, free_ts 161542442975
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1536
prep_new_page mm/page_alloc.c:1543 [inline]
get_page_from_freelist+0x31db/0x3360 mm/page_alloc.c:3170
__alloc_pages+0x255/0x670 mm/page_alloc.c:4426
alloc_slab_page+0x6a/0x160 mm/slub.c:1870
allocate_slab mm/slub.c:2017 [inline]
new_slab+0x84/0x2f0 mm/slub.c:2070
___slab_alloc+0xc85/0x1310 mm/slub.c:3223
__slab_alloc mm/slub.c:3322 [inline]
__slab_alloc_node mm/slub.c:3375 [inline]
slab_alloc_node mm/slub.c:3468 [inline]
__kmem_cache_alloc_node+0x1af/0x270 mm/slub.c:3517
__do_kmalloc_node mm/slab_common.c:1022 [inline]
__kmalloc_node+0xa7/0x230 mm/slab_common.c:1030
kmalloc_node include/linux/slab.h:619 [inline]
kvmalloc_node+0x72/0x180 mm/util.c:607
kvmalloc include/linux/slab.h:737 [inline]
kvmalloc_array include/linux/slab.h:755 [inline]
__ptr_ring_init_queue_alloc include/linux/ptr_ring.h:471 [inline]
ptr_ring_init include/linux/ptr_ring.h:489 [inline]
wg_packet_queue_init+0x92/0x2f0 drivers/net/wireguard/queueing.c:32
wg_newlink+0x417/0x710 drivers/net/wireguard/device.c:358
rtnl_newlink_create net/core/rtnetlink.c:3485 [inline]
__rtnl_newlink net/core/rtnetlink.c:3705 [inline]
rtnl_newlink+0x1579/0x2070 net/core/rtnetlink.c:3718
rtnetlink_rcv_msg+0x87e/0x1030 net/core/rtnetlink.c:6444
netlink_rcv_skb+0x1df/0x430 net/netlink/af_netlink.c:2545
netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
netlink_unicast+0x7dc/0x970 net/netlink/af_netlink.c:1368
netlink_sendmsg+0xa37/0xd70 net/netlink/af_netlink.c:1910
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1136 [inline]
free_unref_page_prepare+0x8c3/0x9f0 mm/page_alloc.c:2312
free_unref_page+0x37/0x3f0 mm/page_alloc.c:2405
discard_slab mm/slub.c:2116 [inline]
__unfreeze_partials+0x1dc/0x220 mm/slub.c:2655
put_cpu_partial+0x17b/0x250 mm/slub.c:2731
__slab_free+0x2b6/0x390 mm/slub.c:3679
qlink_free mm/kasan/quarantine.c:166 [inline]
qlist_free_all+0x75/0xe0 mm/kasan/quarantine.c:185
kasan_quarantine_reduce+0x14b/0x160 mm/kasan/quarantine.c:292
__kasan_slab_alloc+0x23/0x70 mm/kasan/common.c:305
kasan_slab_alloc include/linux/kasan.h:188 [inline]
slab_post_alloc_hook+0x67/0x3d0 mm/slab.h:762
slab_alloc_node mm/slub.c:3478 [inline]
__kmem_cache_alloc_node+0x141/0x270 mm/slub.c:3517
kmalloc_trace+0x2a/0xe0 mm/slab_common.c:1114
kmalloc include/linux/slab.h:599 [inline]
rtnl_newlink+0xeb/0x2070 net/core/rtnetlink.c:3714
rtnetlink_rcv_msg+0x87e/0x1030 net/core/rtnetlink.c:6444
netlink_rcv_skb+0x1df/0x430 net/netlink/af_netlink.c:2545
netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
netlink_unicast+0x7dc/0x970 net/netlink/af_netlink.c:1368
netlink_sendmsg+0xa37/0xd70 net/netlink/af_netlink.c:1910
Memory state around the buggy address:
ffff88807c5b8900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807c5b8980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88807c5b8a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88807c5b8a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807c5b8b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess), 1 bytes skipped:
0: fa cli
1: 31 c0 xor %eax,%eax
3: 83 3d 0f 37 cd 03 00 cmpl $0x0,0x3cd370f(%rip) # 0x3cd3719
a: 74 1d je 0x29
c: 83 3d 76 6a cd 03 00 cmpl $0x0,0x3cd6a76(%rip) # 0x3cd6a89
13: 74 14 je 0x29
15: 65 48 8b 0d 60 75 36 mov %gs:0x75367560(%rip),%rcx # 0x7536757d
1c: 75
1d: 31 c0 xor %eax,%eax
1f: 83 b9 c4 0a 00 00 00 cmpl $0x0,0xac4(%rcx)
26: 0f 94 c0 sete %al
* 29: c3 ret <-- trapping instruction
2a: 0f 1f 00 nopl (%rax)
2d: 66 0f 1f 00 nopw (%rax)
31: 48 8b 3c 24 mov (%rsp),%rdi
35: e8 43 fb ff ff call 0xfffffb7d
3a: 66 90 xchg %ax,%ax
3c: 66 90 xchg %ax,%ax
3e: e9 .byte 0xe9