==================================================================
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 ffff888041c38b68 by task syz.0.0/5336
CPU: 0 UID: 0 PID: 5336 Comm: syz.0.0 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0xca/0x240 mm/kasan/report.c:482
kasan_report+0x118/0x150 mm/kasan/report.c:595
check_region_inline mm/kasan/generic.c:-1 [inline]
kasan_check_range+0x2b0/0x2c0 mm/kasan/generic.c:200
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:2605 [inline]
rcu_core+0xd70/0x1870 kernel/rcu/tree.c:2857
handle_softirqs+0x27d/0x850 kernel/softirq.c:622
__do_softirq kernel/softirq.c:656 [inline]
invoke_softirq kernel/softirq.c:496 [inline]
__irq_exit_rcu+0xca/0x1f0 kernel/softirq.c:723
irq_exit_rcu+0x9/0x30 kernel/softirq.c:739
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1056 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1056
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:697
RIP: 0010:xas_move_index lib/xarray.c:158 [inline]
RIP: 0010:xas_next_offset lib/xarray.c:166 [inline]
RIP: 0010:xas_find+0x55f/0x990 lib/xarray.c:1432
Code: ed 74 08 20 c1 0f 84 0b 03 00 00 48 8b 44 24 10 42 0f b6 04 28 84 c0 0f 85 0b 02 00 00 48 8b 04 24 0f b6 28 40 fe c5 40 88 28 <43> 80 3c 2f 00 74 08 48 89 df e8 92 6e ce f6 4c 8b 33 4c 89 f0 48
RSP: 0018:ffffc9000b2376d0 EFLAGS: 00000206
RAX: ffffc9000b2377f2 RBX: ffffc9000b2377f8 RCX: ffff88800025a401
RDX: 0000000000000002 RSI: 0000000000000000 RDI: 0000000000000002
RBP: 000000000000001b R08: ffff88800025a4c0 R09: 0000000000000002
R10: 0000000000000003 R11: 0000000000000002 R12: ffffc9000b2377e0
R13: dffffc0000000000 R14: 0000000000000000 R15: 1ffff92001646eff
find_get_entry mm/filemap.c:2062 [inline]
find_lock_entries+0x1ff/0xa60 mm/filemap.c:2166
truncate_inode_pages_range+0x1a4/0xd90 mm/truncate.c:400
kill_bdev block/bdev.c:91 [inline]
blkdev_flush_mapping+0x109/0x2f0 block/bdev.c:729
blkdev_put_whole block/bdev.c:736 [inline]
bdev_release+0x417/0x650 block/bdev.c:1161
blkdev_release+0x15/0x20 block/fops.c:706
__fput+0x44c/0xa70 fs/file_table.c:468
task_work_run+0x1d4/0x260 kernel/task_work.c:233
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
__exit_to_user_mode_loop kernel/entry/common.c:44 [inline]
exit_to_user_mode_loop+0xff/0x4f0 kernel/entry/common.c:75
__exit_to_user_mode_prepare include/linux/irq-entry-common.h:226 [inline]
syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:256 [inline]
syscall_exit_to_user_mode_work include/linux/entry-common.h:159 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:194 [inline]
do_syscall_64+0x2e3/0xf80 arch/x86/entry/syscall_64.c:100
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f1be3f90f6a
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 1a 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f1be4eb2e68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: fffffffffffffffb RBX: 00007f1be4eb2ef0 RCX: 00007f1be3f90f6a
RDX: 0000200000000100 RSI: 0000200000012500 RDI: 00007f1be4eb2eb0
RBP: 0000200000000100 R08: 00007f1be4eb2ef0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000200000012500
R13: 00007f1be4eb2eb0 R14: 000000000001251b R15: 0000200000000040
Allocated by task 5336:
kasan_save_stack mm/kasan/common.c:56 [inline]
kasan_save_track+0x3e/0x80 mm/kasan/common.c:77
poison_kmalloc_redzone mm/kasan/common.c:397 [inline]
__kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:414
kasan_kmalloc include/linux/kasan.h:262 [inline]
__kmalloc_cache_noprof+0x3e2/0x700 mm/slub.c:5771
kmalloc_noprof include/linux/slab.h:957 [inline]
kzalloc_noprof include/linux/slab.h:1094 [inline]
init_sbd fs/gfs2/ops_fstype.c:79 [inline]
gfs2_fill_super+0x11f/0x21b0 fs/gfs2/ops_fstype.c:1121
get_tree_bdev_flags+0x40e/0x4d0 fs/super.c:1691
gfs2_get_tree+0x51/0x1e0 fs/gfs2/ops_fstype.c:1332
vfs_get_tree+0x92/0x2a0 fs/super.c:1751
fc_mount fs/namespace.c:1199 [inline]
do_new_mount_fc fs/namespace.c:3636 [inline]
do_new_mount+0x302/0xa10 fs/namespace.c:3712
do_mount fs/namespace.c:4035 [inline]
__do_sys_mount fs/namespace.c:4224 [inline]
__se_sys_mount+0x313/0x410 fs/namespace.c:4201
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 5336:
kasan_save_stack mm/kasan/common.c:56 [inline]
kasan_save_track+0x3e/0x80 mm/kasan/common.c:77
kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:584
poison_slab_object mm/kasan/common.c:252 [inline]
__kasan_slab_free+0x5c/0x80 mm/kasan/common.c:284
kasan_slab_free include/linux/kasan.h:234 [inline]
slab_free_hook mm/slub.c:2540 [inline]
slab_free mm/slub.c:6663 [inline]
kfree+0x1c0/0x660 mm/slub.c:6871
free_sbd fs/gfs2/ops_fstype.c:72 [inline]
gfs2_fill_super+0x14ef/0x21b0 fs/gfs2/ops_fstype.c:1316
get_tree_bdev_flags+0x40e/0x4d0 fs/super.c:1691
gfs2_get_tree+0x51/0x1e0 fs/gfs2/ops_fstype.c:1332
vfs_get_tree+0x92/0x2a0 fs/super.c:1751
fc_mount fs/namespace.c:1199 [inline]
do_new_mount_fc fs/namespace.c:3636 [inline]
do_new_mount+0x302/0xa10 fs/namespace.c:3712
do_mount fs/namespace.c:4035 [inline]
__do_sys_mount fs/namespace.c:4224 [inline]
__se_sys_mount+0x313/0x410 fs/namespace.c:4201
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff888041c38000
which belongs to the cache kmalloc-8k of size 8192
The buggy address is located 2920 bytes inside of
freed 8192-byte region [ffff888041c38000, ffff888041c3a000)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x41c38
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
anon flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 04fff00000000040 ffff88801a442280 ffffea0001073400 0000000000000005
raw: 0000000000000000 0000000080020002 00000000f5000000 0000000000000000
head: 04fff00000000040 ffff88801a442280 ffffea0001073400 0000000000000005
head: 0000000000000000 0000000080020002 00000000f5000000 0000000000000000
head: 04fff00000000003 ffffea0001070e01 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 5300, tgid 5300 (syz-executor), ts 80781014000, free_ts 73190554583
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x234/0x290 mm/page_alloc.c:1846
prep_new_page mm/page_alloc.c:1854 [inline]
get_page_from_freelist+0x2365/0x2440 mm/page_alloc.c:3915
__alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5210
alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2486
alloc_slab_page mm/slub.c:3075 [inline]
allocate_slab+0x86/0x3b0 mm/slub.c:3248
new_slab mm/slub.c:3302 [inline]
___slab_alloc+0xf2b/0x1960 mm/slub.c:4651
__slab_alloc+0x65/0x100 mm/slub.c:4774
__slab_alloc_node mm/slub.c:4850 [inline]
slab_alloc_node mm/slub.c:5246 [inline]
__kmalloc_cache_noprof+0x41e/0x700 mm/slub.c:5766
kmalloc_noprof include/linux/slab.h:957 [inline]
kzalloc_noprof include/linux/slab.h:1094 [inline]
cgroup1_root_to_use kernel/cgroup/cgroup-v1.c:1240 [inline]
cgroup1_get_tree+0x4f4/0x8a0 kernel/cgroup/cgroup-v1.c:1267
vfs_get_tree+0x92/0x2a0 fs/super.c:1751
fc_mount fs/namespace.c:1199 [inline]
do_new_mount_fc fs/namespace.c:3636 [inline]
do_new_mount+0x302/0xa10 fs/namespace.c:3712
do_mount fs/namespace.c:4035 [inline]
__do_sys_mount fs/namespace.c:4224 [inline]
__se_sys_mount+0x313/0x410 fs/namespace.c:4201
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 5303 tgid 5303 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1395 [inline]
__free_frozen_pages+0xbc8/0xd30 mm/page_alloc.c:2943
__folio_put+0x21b/0x2c0 mm/swap.c:112
folio_put include/linux/mm.h:1612 [inline]
put_page include/linux/mm.h:1681 [inline]
do_exit+0x183b/0x2310 kernel/exit.c:1002
do_group_exit+0x21c/0x2d0 kernel/exit.c:1112
__do_sys_exit_group kernel/exit.c:1123 [inline]
__se_sys_exit_group kernel/exit.c:1121 [inline]
__x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1121
__pfx_syscall_get_nr+0x0/0x10 arch/x86/include/generated/asm/syscalls_64.h:232
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff888041c38a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888041c38a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888041c38b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888041c38b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888041c38c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: ed in (%dx),%eax
1: 74 08 je 0xb
3: 20 c1 and %al,%cl
5: 0f 84 0b 03 00 00 je 0x316
b: 48 8b 44 24 10 mov 0x10(%rsp),%rax
10: 42 0f b6 04 28 movzbl (%rax,%r13,1),%eax
15: 84 c0 test %al,%al
17: 0f 85 0b 02 00 00 jne 0x228
1d: 48 8b 04 24 mov (%rsp),%rax
21: 0f b6 28 movzbl (%rax),%ebp
24: 40 fe c5 inc %bpl
27: 40 88 28 mov %bpl,(%rax)
* 2a: 43 80 3c 2f 00 cmpb $0x0,(%r15,%r13,1) <-- trapping instruction
2f: 74 08 je 0x39
31: 48 89 df mov %rbx,%rdi
34: e8 92 6e ce f6 call 0xf6ce6ecb
39: 4c 8b 33 mov (%rbx),%r14
3c: 4c 89 f0 mov %r14,%rax
3f: 48 rex.W