==================================================================
BUG: KASAN: slab-use-after-free in find_endpoint+0x2a3/0x2c0 drivers/usb/gadget/udc/dummy_hcd.c:1618
Read of size 1 at addr ffff88801bf6cce8 by task syz.1.763/8176
CPU: 1 UID: 0 PID: 8176 Comm: syz.1.763 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
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:1618
handle_control_request drivers/usb/gadget/udc/dummy_hcd.c:1761 [inline]
dummy_timer+0x259e/0x3700 drivers/usb/gadget/udc/dummy_hcd.c:1942
__run_hrtimer kernel/time/hrtimer.c:2074 [inline]
__hrtimer_run_queues+0x462/0x9c0 kernel/time/hrtimer.c:2131
hrtimer_run_softirq+0x1ca/0x360 kernel/time/hrtimer.c:2148
handle_softirqs+0x1e6/0x9d0 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0x16a/0x210 kernel/softirq.c:758
irq_exit_rcu+0x9/0x30 kernel/softirq.c:775
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:rcu_is_watching_curr_cpu include/linux/context_tracking.h:128 [inline]
RIP: 0010:rcu_is_watching+0x37/0xc0 kernel/rcu/tree.c:753
Code: 12 e8 4d 2a e1 09 48 c7 c3 e8 ad 8d 94 89 c5 83 f8 07 0f 87 83 00 00 00 48 8d 3c ed 20 79 65 8e 48 b8 00 00 00 00 00 fc ff df <48> 89 fa 48 c1 ea 03 80 3c 02 00 75 5d 48 03 1c ed 20 79 65 8e 48
RSP: 0018:ffffc90006305f08 EFLAGS: 00000297
RAX: dffffc0000000000 RBX: ffffffff948dade8 RCX: 0000000000000002
RDX: 0000000000000001 RSI: ffffffff8c622e00 RDI: ffffffff8e657928
RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000200 R11: 0000000000018a1b R12: 0000000000000002
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
trace_lock_acquire include/trace/events/lock.h:23 [inline]
lock_acquire+0x31e/0x380 kernel/locking/lockdep.c:5905
rcu_lock_acquire include/linux/rcupdate.h:309 [inline]
rcu_read_lock include/linux/rcupdate.h:849 [inline]
class_rcu_constructor include/linux/rcupdate.h:1216 [inline]
unwind_next_frame+0xd1/0x2090 arch/x86/kernel/unwind_orc.c:495
arch_stack_walk+0x94/0xf0 arch/x86/kernel/stacktrace.c:25
stack_trace_save+0x8e/0xc0 kernel/stacktrace.c:122
save_stack+0x162/0x1e0 mm/page_owner.c:183
__set_page_owner+0x8c/0x540 mm/page_owner.c:359
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1871
prep_new_page mm/page_alloc.c:1879 [inline]
get_page_from_freelist+0x110d/0x35d0 mm/page_alloc.c:3943
__alloc_frozen_pages_noprof+0x2eb/0x3300 mm/page_alloc.c:5436
alloc_pages_mpol+0x201/0x550 mm/mempolicy.c:2486
folio_alloc_mpol_noprof+0x36/0x260 mm/mempolicy.c:2505
shmem_alloc_folio+0x135/0x160 mm/shmem.c:1933
shmem_alloc_and_add_folio+0x371/0xd40 mm/shmem.c:1975
shmem_get_folio_gfp+0x75b/0x1980 mm/shmem.c:2528
shmem_fault+0x1fb/0xa30 mm/shmem.c:2729
__do_fault+0x10b/0x440 mm/memory.c:5565
do_read_fault mm/memory.c:6000 [inline]
do_fault+0xb3f/0x1830 mm/memory.c:6134
do_pte_missing mm/memory.c:4700 [inline]
handle_pte_fault mm/memory.c:6558 [inline]
__handle_mm_fault+0x150b/0x2f60 mm/memory.c:6707
handle_mm_fault+0x363/0xa20 mm/memory.c:6876
faultin_page mm/gup.c:1126 [inline]
__get_user_pages+0x8ae/0x2c30 mm/gup.c:1428
__get_user_pages_locked mm/gup.c:1692 [inline]
get_dump_page+0x27e/0x3d0 mm/gup.c:2192
dump_user_range+0x18d/0xad0 fs/coredump.c:1361
elf_core_dump+0x2d68/0x3d20 fs/binfmt_elf.c:2106
coredump_write fs/coredump.c:1047 [inline]
do_coredump fs/coredump.c:1126 [inline]
vfs_coredump+0x281a/0x54a0 fs/coredump.c:1195
get_signal+0x1f2a/0x21e0 kernel/signal.c:3036
arch_do_signal_or_restart+0x91/0x7e0 arch/x86/kernel/signal.c:337
__exit_to_user_mode_loop kernel/entry/common.c:66 [inline]
exit_to_user_mode_loop kernel/entry/common.c:101 [inline]
__exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
irqentry_exit_to_user_mode_prepare include/linux/irq-entry-common.h:244 [inline]
irqentry_exit_to_user_mode include/linux/irq-entry-common.h:315 [inline]
irqentry_exit+0x402/0xa10 kernel/entry/common.c:165
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:595
RIP: 0033:0x7f1cdda53bd7
Code: e8 fe f9 ff ff 89 f2 48 8d 3d 8d 4f 1b 00 48 8d 35 0a 0b 1e 00 31 c0 e8 37 f8 ff ff 0f 1f 80 00 00 00 00 53 89 fb 48 83 ec 10 <64> 8b 04 25 a4 ff ff ff 85 c0 74 2a 89 fe 31 c0 bf 3c 00 00 00 e8
RSP: 002b:00007f1cdea391a0 EFLAGS: 00010206
RAX: 0000000000000000 RBX: 000000000000000b RCX: 00007f1cddb9e159
RDX: 00007f1cdea391c0 RSI: 00007f1cdea392f0 RDI: 000000000000000b
RBP: 00007f1cddc3506b R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000
R13: 00007f1cdde26038 R14: 00007f1cdde25fa0 R15: 00007fffab221e08
Allocated by task 8165:
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:398 [inline]
__kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415
kasan_kmalloc include/linux/kasan.h:263 [inline]
__do_kmalloc_node mm/slub.c:5414 [inline]
__kmalloc_noprof+0x32f/0x840 mm/slub.c:5439
_kmalloc_noprof include/linux/slab.h:995 [inline]
io_cache_alloc_new+0x45/0xe0 io_uring/alloc_cache.c:40
io_cache_alloc io_uring/alloc_cache.h:61 [inline]
io_uring_alloc_async_data+0x17e/0x300 io_uring/io_uring.h:356
io_msg_alloc_async io_uring/net.c:191 [inline]
io_recvmsg_prep_setup io_uring/net.c:752 [inline]
io_recvmsg_prep+0x7cd/0x1040 io_uring/net.c:840
io_init_req io_uring/io_uring.c:1833 [inline]
io_submit_sqe io_uring/io_uring.c:1880 [inline]
io_submit_sqes+0xa03/0x2480 io_uring/io_uring.c:2048
__do_sys_io_uring_enter+0xa88/0x1b10 io_uring/io_uring.c:2637
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 6043:
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:253 [inline]
__kasan_slab_free+0x5f/0x80 mm/kasan/common.c:285
kasan_slab_free include/linux/kasan.h:235 [inline]
slab_free_hook mm/slub.c:2748 [inline]
slab_free mm/slub.c:6508 [inline]
kfree+0x22b/0x6d0 mm/slub.c:6801
io_clean_op io_uring/io_uring.c:328 [inline]
io_free_batch_list io_uring/io_uring.c:1116 [inline]
__io_submit_flush_completions+0x1570/0x1ac0 io_uring/io_uring.c:1154
io_submit_flush_completions io_uring/io_uring.h:253 [inline]
ctx_flush_and_put.isra.0+0x9a/0x410 io_uring/tw.c:26
tctx_task_work_run+0x1a7/0xbf0 io_uring/tw.c:90
io_tctx_fallback_work+0x7f/0x150 io_uring/tw.c:42
process_one_work+0xac7/0x1b10 kernel/workqueue.c:3396
process_scheduled_works kernel/workqueue.c:3479 [inline]
worker_thread+0x5ef/0xe50 kernel/workqueue.c:3560
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
The buggy address belongs to the object at ffff88801bf6cc00
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 232 bytes inside of
freed 512-byte region [ffff88801bf6cc00, ffff88801bf6ce00)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1bf6c
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 ffff88801c042c80 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000
head: 00fff00000000040 ffff88801c042c80 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 7957, tgid 7954 (syz.1.711), ts 124435316010
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1871
prep_new_page mm/page_alloc.c:1879 [inline]
get_page_from_freelist+0x110d/0x35d0 mm/page_alloc.c:3943
__alloc_frozen_pages_noprof+0x2eb/0x3300 mm/page_alloc.c:5436
alloc_slab_page mm/slub.c:3347 [inline]
allocate_slab mm/slub.c:3462 [inline]
new_slab+0xa9/0x6e0 mm/slub.c:3513
refill_objects+0xe3/0x410 mm/slub.c:7417
refill_sheaf mm/slub.c:2885 [inline]
__pcs_replace_empty_main+0x35e/0x650 mm/slub.c:4774
alloc_from_pcs mm/slub.c:4850 [inline]
slab_alloc_node mm/slub.c:4984 [inline]
__kmalloc_cache_noprof+0x4f4/0x6d0 mm/slub.c:5559
_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+0x5d0/0x6e0 sound/core/oss/mixer_oss.c:988
snd_mixer_oss_build_input+0x139/0xd50 sound/core/oss/mixer_oss.c:1017
snd_mixer_oss_build sound/core/oss/mixer_oss.c:1276 [inline]
snd_mixer_oss_notify_handler+0x48d/0x990 sound/core/oss/mixer_oss.c:1344
snd_card_register+0x2af/0x760 sound/core/init.c:935
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:1662
page last free pid 7957 tgid 7954 ts 124362671107 stack trace:
reset_page_owner include/linux/page_owner.h:26 [inline]
__free_pages_prepare mm/page_alloc.c:1418 [inline]
__free_frozen_pages+0x79f/0x10f0 mm/page_alloc.c:2962
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x47/0xf0 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x1a0/0x1f0 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:350
kasan_slab_alloc include/linux/kasan.h:253 [inline]
slab_post_alloc_hook mm/slub.c:4683 [inline]
slab_alloc_node mm/slub.c:4996 [inline]
__kmalloc_cache_noprof+0x278/0x6d0 mm/slub.c:5559
_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+0x54c/0x6e0 sound/core/oss/mixer_oss.c:983
snd_mixer_oss_build_input+0x139/0xd50 sound/core/oss/mixer_oss.c:1017
snd_mixer_oss_build sound/core/oss/mixer_oss.c:1276 [inline]
snd_mixer_oss_notify_handler+0x48d/0x990 sound/core/oss/mixer_oss.c:1344
snd_card_register+0x2af/0x760 sound/core/init.c:935
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:1662
call_driver_probe drivers/base/dd.c:628 [inline]
really_probe+0x241/0xa60 drivers/base/dd.c:706
__driver_probe_device+0x210/0x460 drivers/base/dd.c:868
Memory state around the buggy address:
ffff88801bf6cb80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88801bf6cc00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88801bf6cc80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88801bf6cd00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88801bf6cd80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess), 1 bytes skipped:
0: e8 4d 2a e1 09 call 0x9e12a52
5: 48 c7 c3 e8 ad 8d 94 mov $0xffffffff948dade8,%rbx
c: 89 c5 mov %eax,%ebp
e: 83 f8 07 cmp $0x7,%eax
11: 0f 87 83 00 00 00 ja 0x9a
17: 48 8d 3c ed 20 79 65 lea -0x719a86e0(,%rbp,8),%rdi
1e: 8e
1f: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
26: fc ff df
* 29: 48 89 fa mov %rdi,%rdx <-- trapping instruction
2c: 48 c1 ea 03 shr $0x3,%rdx
30: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1)
34: 75 5d jne 0x93
36: 48 03 1c ed 20 79 65 add -0x719a86e0(,%rbp,8),%rbx
3d: 8e
3e: 48 rex.W