==================================================================
BUG: KASAN: slab-use-after-free in find_endpoint+0x2a3/0x2c0 drivers/usb/gadget/udc/dummy_hcd.c:1650
Read of size 1 at addr ffff888028f41ce8 by task kworker/u33:2/58
CPU: 2 UID: 0 PID: 58 Comm: kworker/u33:2 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Workqueue: events_unbound toggle_allocation_gate
Call Trace:
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0x13d/0x4b0 mm/kasan/report.c:482
kasan_report+0xdf/0x1c0 mm/kasan/report.c:595
find_endpoint+0x2a3/0x2c0 drivers/usb/gadget/udc/dummy_hcd.c:1650
handle_control_request drivers/usb/gadget/udc/dummy_hcd.c:1793 [inline]
dummy_timer+0x2745/0x3840 drivers/usb/gadget/udc/dummy_hcd.c:1974
__run_hrtimer kernel/time/hrtimer.c:2079 [inline]
__hrtimer_run_queues+0x448/0x9a0 kernel/time/hrtimer.c:2136
hrtimer_run_softirq+0x1ca/0x360 kernel/time/hrtimer.c:2153
handle_softirqs+0x216/0xa20 kernel/softirq.c:669
__do_softirq kernel/softirq.c:703 [inline]
invoke_softirq kernel/softirq.c:542 [inline]
__irq_exit_rcu+0x178/0x220 kernel/softirq.c:786
irq_exit_rcu+0x9/0x30 kernel/softirq.c:809
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa3/0xc0 arch/x86/kernel/apic/apic.c:1062
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:__sanitizer_cov_trace_const_cmp4+0x8/0x20 kernel/kcov.c:328
Code: bf 03 00 00 00 e9 38 fe ff ff 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 48 8b 0c 24 <89> f2 89 fe bf 05 00 00 00 e9 0a fe ff ff 66 2e 0f 1f 84 00 00 00
RSP: 0018:ffffc90000abf898 EFLAGS: 00000202
RAX: 0000000000000001 RBX: 0000000000000003 RCX: ffffffff8201a513
RDX: ffff8880212c4b00 RSI: 0000000000000001 RDI: 0000000000000000
RBP: ffff88806a3447e0 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000001 R11: 0000000000000000 R12: ffffed1004258c13
R13: 0000000000000003 R14: ffffed100d4688fd R15: 0000000000000001
csd_lock_wait kernel/smp.c:389 [inline]
smp_call_function_many_cond+0x913/0x18c0 kernel/smp.c:1028
on_each_cpu include/linux/smp.h:71 [inline]
smp_text_poke_sync_each_cpu arch/x86/kernel/alternative.c:2642 [inline]
smp_text_poke_batch_finish+0x332/0xc60 arch/x86/kernel/alternative.c:2852
arch_jump_label_transform_apply+0x1c/0x30 arch/x86/kernel/jump_label.c:146
jump_label_update+0x37a/0x550 kernel/jump_label.c:909
static_key_enable_cpuslocked+0x1bc/0x270 kernel/jump_label.c:210
static_key_enable+0x1a/0x20 kernel/jump_label.c:223
toggle_allocation_gate mm/kfence/core.c:902 [inline]
toggle_allocation_gate+0xfe/0x2d0 mm/kfence/core.c:894
process_one_work+0xac7/0x1b10 kernel/workqueue.c:3495
process_scheduled_works kernel/workqueue.c:3578 [inline]
worker_thread+0x5ef/0xe50 kernel/workqueue.c:3659
kthread+0x373/0x450 kernel/kthread.c:436
ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
Allocated by task 9346:
kasan_save_stack+0x30/0x50 mm/kasan/common.c:57
kasan_save_track+0x14/0x30 mm/kasan/common.c:78
poison_kmalloc_redzone mm/kasan/common.c:409 [inline]
__kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:426
kasan_kmalloc include/linux/kasan.h:263 [inline]
__do_kmalloc_node mm/slub.c:5531 [inline]
__kmalloc_noprof+0x32f/0x840 mm/slub.c:5556
_kmalloc_noprof include/linux/slab.h:995 [inline]
_kzalloc_noprof include/linux/slab.h:1312 [inline]
security_inode_init_security+0x113/0x370 security/security.c:1361
shmem_symlink+0x163/0xbf0 mm/shmem.c:4317
vfs_symlink fs/namei.c:5812 [inline]
vfs_symlink+0x17b/0x520 fs/namei.c:5791
filename_symlinkat+0x2a6/0x5a0 fs/namei.c:5837
__do_sys_symlinkat fs/namei.c:5857 [inline]
__se_sys_symlinkat fs/namei.c:5852 [inline]
__x64_sys_symlinkat+0x9c/0xe0 fs/namei.c:5852
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 9346:
kasan_save_stack+0x30/0x50 mm/kasan/common.c:57
kasan_save_track+0x14/0x30 mm/kasan/common.c:78
kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584
poison_slab_object mm/kasan/common.c:264 [inline]
__kasan_slab_free+0x5f/0x80 mm/kasan/common.c:296
kasan_slab_free include/linux/kasan.h:235 [inline]
slab_free_hook mm/slub.c:2780 [inline]
slab_free mm/slub.c:6630 [inline]
kfree+0x22b/0x6d0 mm/slub.c:6923
security_inode_init_security+0x2bf/0x370 security/security.c:1389
shmem_symlink+0x163/0xbf0 mm/shmem.c:4317
vfs_symlink fs/namei.c:5812 [inline]
vfs_symlink+0x17b/0x520 fs/namei.c:5791
filename_symlinkat+0x2a6/0x5a0 fs/namei.c:5837
__do_sys_symlinkat fs/namei.c:5857 [inline]
__se_sys_symlinkat fs/namei.c:5852 [inline]
__x64_sys_symlinkat+0x9c/0xe0 fs/namei.c:5852
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff888028f41c00
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 232 bytes inside of
freed 512-byte region [ffff888028f41c00, ffff888028f41e00)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x28f40
head: order:2 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 ffff88801d442c80 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000
head: 00fff00000000040 ffff88801d442c80 dead000000000100 dead000000000122
head: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000
head: 00fff00000000002 ffffffffffffff01 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000004
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 6996, tgid 6994 (syz.0.308), ts 168222506351
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1859
prep_new_page mm/page_alloc.c:1867 [inline]
get_page_from_freelist+0x112f/0x3640 mm/page_alloc.c:3940
__alloc_frozen_pages_noprof+0x2ad/0x31e0 mm/page_alloc.c:5464
alloc_slab_page mm/slub.c:3384 [inline]
allocate_slab mm/slub.c:3499 [inline]
new_slab+0xb1/0x6d0 mm/slub.c:3550
refill_objects+0xe3/0x410 mm/slub.c:7539
refill_sheaf mm/slub.c:2917 [inline]
__pcs_replace_empty_main+0x35e/0x650 mm/slub.c:4811
alloc_from_pcs mm/slub.c:4887 [inline]
slab_alloc_node mm/slub.c:5021 [inline]
__kmalloc_cache_noprof+0x4ef/0x6d0 mm/slub.c:5676
_kmalloc_noprof include/linux/slab.h:991 [inline]
snd_mixer_oss_build_test+0x7a/0x380 sound/core/oss/mixer_oss.c:893
snd_mixer_oss_build_test_all+0x2b4/0x6e0 sound/core/oss/mixer_oss.c:958
snd_mixer_oss_build_input+0x139/0xd50 sound/core/oss/mixer_oss.c:1017
snd_mixer_oss_build sound/core/oss/mixer_oss.c:1277 [inline]
snd_mixer_oss_notify_handler+0x4e5/0xa10 sound/core/oss/mixer_oss.c:1355
snd_mixer_oss_notify sound/core/init.c:92 [inline]
snd_card_register+0x2bd/0x780 sound/core/init.c:929
f_midi2_create_card drivers/usb/gadget/function/f_midi2.c:1615 [inline]
f_midi2_bind+0x1198/0x2770 drivers/usb/gadget/function/f_midi2.c:1947
usb_add_function+0x219/0x890 drivers/usb/gadget/composite.c:333
configfs_composite_bind+0xd83/0x1960 drivers/usb/gadget/configfs.c:1802
gadget_bind_driver+0x28c/0xbf0 drivers/usb/gadget/udc/core.c:1663
page last free pid 6889 tgid 6889 ts 163824185091 stack trace:
reset_page_owner include/linux/page_owner.h:26 [inline]
__free_pages_prepare mm/page_alloc.c:1403 [inline]
__free_frozen_pages+0x7b4/0x1110 mm/page_alloc.c:2957
kvm_destroy_vm virt/kvm/kvm_main.c:1325 [inline]
kvm_put_kvm+0x963/0xc00 virt/kvm/kvm_main.c:1350
kvm_vm_release+0x65/0x80 virt/kvm/kvm_main.c:1375
__fput+0x3fb/0xb50 fs/file_table.c:512
fput_close_sync+0x118/0x250 fs/file_table.c:618
filp_close_sync+0x75/0xa0 fs/open.c:1574
__range_close+0x4a6/0x8b0 fs/file.c:919
__do_sys_close_range fs/file.c:1003 [inline]
__se_sys_close_range fs/file.c:954 [inline]
__x64_sys_close_range+0x1f8/0x430 fs/file.c:954
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff888028f41b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888028f41c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888028f41c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888028f41d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888028f41d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: bf 03 00 00 00 mov $0x3,%edi
5: e9 38 fe ff ff jmp 0xfffffe42
a: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1)
11: 00
12: 90 nop
13: 90 nop
14: 90 nop
15: 90 nop
16: 90 nop
17: 90 nop
18: 90 nop
19: 90 nop
1a: 90 nop
1b: 90 nop
1c: 90 nop
1d: 90 nop
1e: 90 nop
1f: 90 nop
20: 90 nop
21: 90 nop
22: f3 0f 1e fa endbr64
26: 48 8b 0c 24 mov (%rsp),%rcx
* 2a: 89 f2 mov %esi,%edx <-- trapping instruction
2c: 89 fe mov %edi,%esi
2e: bf 05 00 00 00 mov $0x5,%edi
33: e9 0a fe ff ff jmp 0xfffffe42
38: 66 data16
39: 2e cs
3a: 0f .byte 0xf
3b: 1f (bad)
3c: 84 00 test %al,(%rax)