==================================================================
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 ffff8880730930e8 by task syz.2.1546/11871
CPU: 0 UID: 0 PID: 11871 Comm: syz.2.1546 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
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
dummy_timer+0x506/0x3840 drivers/usb/gadget/udc/dummy_hcd.c:1922
__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:write_comp_data+0x47/0xb0 kernel/kcov.c:252
Code: 00 01 00 ff 74 1e f6 c4 01 74 75 a9 00 00 00 0f 75 6e f7 c2 00 00 00 f0 75 66 8b 81 44 17 00 00 85 c0 74 5c 8b 81 18 17 00 00 <83> f8 03 75 51 48 8b 91 20 17 00 00 8b 81 1c 17 00 00 48 8b 0a 4c
RSP: 0018:ffffc90003ee6970 EFLAGS: 00000246
RAX: 0000000000000000 RBX: 800000005b762025 RCX: ffff88802ad54b00
RDX: 0000000000000001 RSI: ffffffff826a2db5 RDI: 0000000000000001
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: ffffc90003ee69df R11: 0000000000000001 R12: ffffc90003ee6d80
R13: ffff888025bc0280 R14: 0000000000000000 R15: ffff888025bc0280
set_pte_range+0x285/0xa20 mm/memory.c:5833
filemap_map_order0_folio mm/filemap.c:3907 [inline]
filemap_map_pages+0x736/0x1f10 mm/filemap.c:3978
do_fault_around mm/memory.c:6070 [inline]
do_read_fault mm/memory.c:6103 [inline]
do_fault+0xa76/0x1890 mm/memory.c:6246
do_pte_missing mm/memory.c:4778 [inline]
handle_pte_fault mm/memory.c:6665 [inline]
__handle_mm_fault+0x1858/0x2f40 mm/memory.c:6817
handle_mm_fault+0x363/0xa30 mm/memory.c:6984
faultin_page mm/gup.c:1130 [inline]
__get_user_pages+0x7ca/0x1d50 mm/gup.c:1432
__get_user_pages_locked mm/gup.c:1696 [inline]
get_dump_page+0x27e/0x3d0 mm/gup.c:2211
dump_user_range+0x19c/0xe90 fs/coredump.c:1595
elf_core_dump+0x3200/0x4300 fs/binfmt_elf.c:2106
coredump_write+0xd88/0x1c20 fs/coredump.c:1150
do_coredump.constprop.0+0x9bb/0x25e0 fs/coredump.c:1237
vfs_coredump+0x9b0/0x1180 fs/coredump.c:1312
get_signal+0x1fba/0x22e0 kernel/signal.c:3098
arch_do_signal_or_restart+0x91/0x7a0 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+0x542/0xab0 kernel/entry/common.c:152
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:595
RIP: 0023:0x0
Code: Unable to access opcode bytes at 0xffffffffffffffd6.
RSP: 002b:0000000080000390 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000020000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
Allocated by task 11660:
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_flags_noprof+0x370/0x8e0 mm/slub.c:5719
_kmalloc_flags_noprof mm/slab.h:55 [inline]
__alloc_empty_sheaf mm/slub.c:2854 [inline]
alloc_empty_sheaf mm/slub.c:2874 [inline]
__pcs_replace_empty_main+0x3fa/0x650 mm/slub.c:4806
alloc_from_pcs mm/slub.c:4887 [inline]
slab_alloc_node mm/slub.c:5021 [inline]
kmem_cache_alloc_noprof+0x4bf/0x6a0 mm/slub.c:5047
cache_alloc_handle mm/zsmalloc.c:445 [inline]
zs_malloc+0xce/0x14c0 mm/zsmalloc.c:1322
zswap_compress mm/zswap.c:915 [inline]
zswap_store_page mm/zswap.c:1454 [inline]
zswap_store+0x103c/0x2f90 mm/zswap.c:1569
swap_writeout+0xdcf/0x1b30 mm/page_io.c:238
pageout mm/vmscan.c:732 [inline]
shrink_folio_list+0x528c/0x59c0 mm/vmscan.c:1505
evict_folios+0x35b/0x1790 mm/vmscan.c:5097
try_to_shrink_lruvec+0x32e/0x7b0 mm/vmscan.c:5271
shrink_one+0x342/0x870 mm/vmscan.c:5318
shrink_many mm/vmscan.c:5381 [inline]
lru_gen_shrink_node mm/vmscan.c:5459 [inline]
shrink_node+0x2a61/0x4410 mm/vmscan.c:6465
shrink_zones mm/vmscan.c:6701 [inline]
do_try_to_free_pages+0x2da/0x1500 mm/vmscan.c:6763
try_to_free_pages+0x2a0/0x740 mm/vmscan.c:7002
__perform_reclaim mm/page_alloc.c:4441 [inline]
__alloc_pages_direct_reclaim mm/page_alloc.c:4464 [inline]
__alloc_pages_slowpath mm/page_alloc.c:4959 [inline]
__alloc_frozen_pages_noprof+0x11b6/0x31e0 mm/page_alloc.c:5477
alloc_pages_mpol+0x201/0x560 mm/mempolicy.c:2511
folio_alloc_mpol_noprof+0x36/0x260 mm/mempolicy.c:2530
shmem_alloc_folio+0x135/0x160 mm/shmem.c:2184
shmem_alloc_and_add_folio+0x371/0xd40 mm/shmem.c:2226
shmem_get_folio_gfp+0x758/0x1af0 mm/shmem.c:2780
shmem_get_folio mm/shmem.c:2879 [inline]
shmem_write_begin+0x1a4/0x420 mm/shmem.c:3514
generic_perform_write+0x292/0xa40 mm/filemap.c:4392
shmem_file_write_iter+0x10e/0x140 mm/shmem.c:3689
__kernel_write_iter+0x2ac/0x930 fs/read_write.c:621
dump_write_iter fs/coredump.c:1360 [inline]
dump_emit_page fs/coredump.c:1533 [inline]
dump_user_range+0xa0d/0xe90 fs/coredump.c:1601
elf_core_dump+0x3200/0x4300 fs/binfmt_elf.c:2106
coredump_write+0xd88/0x1c20 fs/coredump.c:1150
do_coredump.constprop.0+0x9bb/0x25e0 fs/coredump.c:1237
vfs_coredump+0x9b0/0x1180 fs/coredump.c:1312
get_signal+0x1fba/0x22e0 kernel/signal.c:3098
arch_do_signal_or_restart+0x91/0x7a0 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+0x542/0xab0 kernel/entry/common.c:152
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:595
Freed by task 11660:
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
__free_empty_sheaf mm/slub.c:2894 [inline]
free_empty_sheaf mm/slub.c:2901 [inline]
__pcs_replace_empty_main+0x390/0x650 mm/slub.c:4817
alloc_from_pcs mm/slub.c:4887 [inline]
slab_alloc_node mm/slub.c:5021 [inline]
kmem_cache_alloc_noprof+0x4bf/0x6a0 mm/slub.c:5047
cache_alloc_handle mm/zsmalloc.c:445 [inline]
zs_malloc+0xce/0x14c0 mm/zsmalloc.c:1322
zswap_compress mm/zswap.c:915 [inline]
zswap_store_page mm/zswap.c:1454 [inline]
zswap_store+0x103c/0x2f90 mm/zswap.c:1569
swap_writeout+0xdcf/0x1b30 mm/page_io.c:238
pageout mm/vmscan.c:732 [inline]
shrink_folio_list+0x528c/0x59c0 mm/vmscan.c:1505
evict_folios+0x35b/0x1790 mm/vmscan.c:5097
try_to_shrink_lruvec+0x32e/0x7b0 mm/vmscan.c:5271
shrink_one+0x342/0x870 mm/vmscan.c:5318
shrink_many mm/vmscan.c:5381 [inline]
lru_gen_shrink_node mm/vmscan.c:5459 [inline]
shrink_node+0x2a61/0x4410 mm/vmscan.c:6465
shrink_zones mm/vmscan.c:6701 [inline]
do_try_to_free_pages+0x2da/0x1500 mm/vmscan.c:6763
try_to_free_pages+0x2a0/0x740 mm/vmscan.c:7002
__perform_reclaim mm/page_alloc.c:4441 [inline]
__alloc_pages_direct_reclaim mm/page_alloc.c:4464 [inline]
__alloc_pages_slowpath mm/page_alloc.c:4959 [inline]
__alloc_frozen_pages_noprof+0x11b6/0x31e0 mm/page_alloc.c:5477
alloc_pages_mpol+0x201/0x560 mm/mempolicy.c:2511
folio_alloc_mpol_noprof+0x36/0x260 mm/mempolicy.c:2530
shmem_alloc_folio+0x135/0x160 mm/shmem.c:2184
shmem_alloc_and_add_folio+0x371/0xd40 mm/shmem.c:2226
shmem_get_folio_gfp+0x758/0x1af0 mm/shmem.c:2780
shmem_get_folio mm/shmem.c:2879 [inline]
shmem_write_begin+0x1a4/0x420 mm/shmem.c:3514
generic_perform_write+0x292/0xa40 mm/filemap.c:4392
shmem_file_write_iter+0x10e/0x140 mm/shmem.c:3689
__kernel_write_iter+0x2ac/0x930 fs/read_write.c:621
dump_write_iter fs/coredump.c:1360 [inline]
dump_emit_page fs/coredump.c:1533 [inline]
dump_user_range+0xa0d/0xe90 fs/coredump.c:1601
elf_core_dump+0x3200/0x4300 fs/binfmt_elf.c:2106
coredump_write+0xd88/0x1c20 fs/coredump.c:1150
do_coredump.constprop.0+0x9bb/0x25e0 fs/coredump.c:1237
vfs_coredump+0x9b0/0x1180 fs/coredump.c:1312
get_signal+0x1fba/0x22e0 kernel/signal.c:3098
arch_do_signal_or_restart+0x91/0x7a0 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+0x542/0xab0 kernel/entry/common.c:152
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:595
The buggy address belongs to the object at ffff888073093000
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 232 bytes inside of
freed 512-byte region [ffff888073093000, ffff888073093200)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888073093000 pfn:0x73090
head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x4fff00000000240(workingset|head|node=1|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 04fff00000000240 ffff88801d442c80 ffffea00013d1710 ffffea0001342510
raw: ffff888073093000 000000000010000b 00000000f5000000 0000000000000000
head: 04fff00000000240 ffff88801d442c80 ffffea00013d1710 ffffea0001342510
head: ffff888073093000 000000000010000b 00000000f5000000 0000000000000000
head: 04fff00000000002 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 8910, tgid 8910 (udevd), ts 192298631690
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]
_kzalloc_noprof include/linux/slab.h:1312 [inline]
kernfs_fop_open+0x347/0x10f0 fs/kernfs/file.c:648
do_dentry_open+0x674/0x1470 fs/open.c:1000
vfs_open_consume+0xcc/0x460 fs/open.c:1131
do_open fs/namei.c:4851 [inline]
path_openat+0x1547/0x23f0 fs/namei.c:5016
do_file_open+0x20e/0x430 fs/namei.c:5045
do_sys_openat2+0x163/0x1d0 fs/open.c:1443
do_sys_open fs/open.c:1449 [inline]
__do_sys_openat fs/open.c:1465 [inline]
__se_sys_openat fs/open.c:1460 [inline]
__x64_sys_openat+0x12d/0x210 fs/open.c:1460
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x121/0x770 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 9658 tgid 9658 ts 191909158373 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
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:361
kasan_slab_alloc include/linux/kasan.h:253 [inline]
slab_post_alloc_hook mm/slub.c:4720 [inline]
slab_alloc_node mm/slub.c:5033 [inline]
__kmalloc_cache_noprof+0x278/0x6d0 mm/slub.c:5676
_kmalloc_noprof include/linux/slab.h:991 [inline]
single_open+0x4d/0x1d0 fs/seq_file.c:575
proc_reg_open+0x137/0x5f0 fs/proc/inode.c:482
do_dentry_open+0x674/0x1470 fs/open.c:1000
vfs_open_consume+0xcc/0x460 fs/open.c:1131
do_open fs/namei.c:4851 [inline]
path_openat+0x1547/0x23f0 fs/namei.c:5016
do_file_open+0x20e/0x430 fs/namei.c:5045
do_sys_openat2+0x163/0x1d0 fs/open.c:1443
do_sys_open fs/open.c:1449 [inline]
__do_sys_openat fs/open.c:1465 [inline]
__se_sys_openat fs/open.c:1460 [inline]
__x64_sys_openat+0x12d/0x210 fs/open.c:1460
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x121/0x770 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff888073092f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888073093000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888073093080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888073093100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888073093180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: 00 01 add %al,(%rcx)
2: 00 ff add %bh,%bh
4: 74 1e je 0x24
6: f6 c4 01 test $0x1,%ah
9: 74 75 je 0x80
b: a9 00 00 00 0f test $0xf000000,%eax
10: 75 6e jne 0x80
12: f7 c2 00 00 00 f0 test $0xf0000000,%edx
18: 75 66 jne 0x80
1a: 8b 81 44 17 00 00 mov 0x1744(%rcx),%eax
20: 85 c0 test %eax,%eax
22: 74 5c je 0x80
24: 8b 81 18 17 00 00 mov 0x1718(%rcx),%eax
* 2a: 83 f8 03 cmp $0x3,%eax <-- trapping instruction
2d: 75 51 jne 0x80
2f: 48 8b 91 20 17 00 00 mov 0x1720(%rcx),%rdx
36: 8b 81 1c 17 00 00 mov 0x171c(%rcx),%eax
3c: 48 8b 0a mov (%rdx),%rcx
3f: 4c rex.WR