================================================================== BUG: KASAN: slab-out-of-bounds in find_endpoint+0x2a3/0x2c0 drivers/usb/gadget/udc/dummy_hcd.c:1618 Read of size 1 at addr ffff888029597293 by task syz.3.3593/22326 CPU: 3 UID: 0 PID: 22326 Comm: syz.3.3593 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:1618 dummy_timer+0x500/0x36f0 drivers/usb/gadget/udc/dummy_hcd.c:1890 __run_hrtimer kernel/time/hrtimer.c:2032 [inline] __hrtimer_run_queues+0x462/0x9c0 kernel/time/hrtimer.c:2096 hrtimer_run_softirq+0x17d/0x2c0 kernel/time/hrtimer.c:2113 handle_softirqs+0x1ea/0x9b0 kernel/softirq.c:622 __do_softirq kernel/softirq.c:656 [inline] invoke_softirq kernel/softirq.c:496 [inline] __irq_exit_rcu+0x162/0x210 kernel/softirq.c:735 irq_exit_rcu+0x9/0x30 kernel/softirq.c:752 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:finish_task_switch.isra.0+0x2cd/0x10c0 kernel/sched/core.c:5361 Code: ab 0a 00 00 41 c7 87 20 0e 00 00 00 00 00 00 e9 47 04 00 00 49 8d 7f 48 e8 00 0c e8 09 e8 ab 93 3c 00 fb 48 8d bb 00 17 00 00 <48> b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 0f b6 04 02 84 RSP: 0000:ffffc90004b5f078 EFLAGS: 00000206 RAX: 0000000000006471 RBX: ffff888023e62580 RCX: 0000000000000040 RDX: 0000000000000000 RSI: ffffffff8e1a6ce3 RDI: ffff888023e63c80 RBP: ffffc90004b5f0d0 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: ffff8880208a0000 R13: 0000000000000001 R14: ffffffff91224184 R15: ffff88802b53b800 context_switch kernel/sched/core.c:5513 [inline] __schedule+0x1264/0x6730 kernel/sched/core.c:7234 preempt_schedule_irq+0x50/0x90 kernel/sched/core.c:7556 irqentry_exit_to_kernel_mode_preempt include/linux/irq-entry-common.h:468 [inline] irqentry_exit_to_kernel_mode include/linux/irq-entry-common.h:539 [inline] irqentry_exit+0x205/0xa10 kernel/entry/common.c:167 asm_sysvec_reschedule_ipi+0x1a/0x20 arch/x86/include/asm/idtentry.h:679 RIP: 0010:lock_acquire+0x5e/0x370 kernel/locking/lockdep.c:5872 Code: 05 fb 50 7e 12 83 f8 07 0f 87 da 00 00 00 48 0f a3 05 86 8e 3c 0f 0f 82 ac 02 00 00 8b 35 2e c2 3c 0f 85 f6 0f 85 c7 00 00 00 <48> 8b 44 24 30 65 48 2b 05 9d 50 7e 12 0f 85 ec 02 00 00 48 83 c4 RSP: 0000:ffffc90004b5f358 EFLAGS: 00000206 RAX: 0000000000000046 RBX: 0000000000000000 RCX: 1bc7805e9d2ad394 RDX: 0000000000000000 RSI: ffffffff8e180d11 RDI: ffffffff8c400d80 RBP: ffffffff8ede2ae0 R08: 00000000986878b0 R09: 00000000000000b5 R10: 0000000000000200 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000000 fs_reclaim_acquire mm/page_alloc.c:4346 [inline] fs_reclaim_acquire+0x8c/0x100 mm/page_alloc.c:4337 might_alloc include/linux/sched/mm.h:317 [inline] prepare_alloc_pages+0x166/0x5f0 mm/page_alloc.c:5048 __alloc_frozen_pages_noprof+0x1af/0x2dc0 mm/page_alloc.c:5293 alloc_pages_mpol+0x1fb/0x540 mm/mempolicy.c:2490 folio_alloc_mpol_noprof+0x36/0x260 mm/mempolicy.c:2509 vma_alloc_folio_noprof+0xed/0x1d0 mm/mempolicy.c:2544 folio_prealloc mm/memory.c:1207 [inline] alloc_anon_folio mm/memory.c:5247 [inline] do_anonymous_page+0xb2b/0x2080 mm/memory.c:5342 do_pte_missing mm/memory.c:4564 [inline] handle_pte_fault mm/memory.c:6379 [inline] __handle_mm_fault+0x1d2c/0x2a00 mm/memory.c:6517 handle_mm_fault+0x37b/0xa30 mm/memory.c:6686 faultin_page mm/gup.c:1126 [inline] __get_user_pages+0x1178/0x32a0 mm/gup.c:1428 populate_vma_page_range+0x267/0x3f0 mm/gup.c:1860 __mm_populate+0x107/0x3a0 mm/gup.c:1963 do_mlock+0x3f0/0x7f0 mm/mlock.c:659 __do_sys_mlock mm/mlock.c:667 [inline] __se_sys_mlock mm/mlock.c:665 [inline] __ia32_sys_mlock+0x57/0x80 mm/mlock.c:665 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] __do_fast_syscall_32+0xe7/0x970 arch/x86/entry/syscall_32.c:307 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf6feefec Code: Unable to access opcode bytes at 0xf6feefc2. RSP: 002b:00000000f53bc50c EFLAGS: 00000292 ORIG_RAX: 0000000000000096 RAX: ffffffffffffffda RBX: 0000000080000000 RCX: 0000000000800000 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 18098: 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:5334 [inline] __kmalloc_node_noprof+0x339/0x830 mm/slub.c:5346 _kmalloc_node_noprof include/linux/slab.h:1197 [inline] qdisc_alloc+0xbb/0xb30 net/sched/sch_generic.c:998 qdisc_create_dflt+0x93/0x490 net/sched/sch_generic.c:1053 attach_one_default_qdisc net/sched/sch_generic.c:1219 [inline] netdev_for_each_tx_queue include/linux/netdevice.h:2737 [inline] attach_default_qdiscs net/sched/sch_generic.c:1237 [inline] dev_activate+0x64f/0xce0 net/sched/sch_generic.c:1296 __dev_open+0x490/0x8f0 net/core/dev.c:1711 __dev_change_flags+0x596/0x850 net/core/dev.c:9764 rtnl_configure_link+0xfe/0x280 net/core/rtnetlink.c:3667 rtnl_newlink_create net/core/rtnetlink.c:3923 [inline] __rtnl_newlink net/core/rtnetlink.c:4044 [inline] rtnl_newlink+0x153b/0x2380 net/core/rtnetlink.c:4159 rtnetlink_rcv_msg+0x95e/0xe90 net/core/rtnetlink.c:7076 netlink_rcv_skb+0x159/0x420 net/netlink/af_netlink.c:2556 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x585/0x850 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x8b0/0xda0 net/netlink/af_netlink.c:1900 sock_sendmsg_nosec net/socket.c:800 [inline] __sock_sendmsg net/socket.c:815 [inline] ____sys_sendmsg+0xa4d/0xbe0 net/socket.c:2709 ___sys_sendmsg+0x190/0x1e0 net/socket.c:2763 __sys_sendmsg+0x160/0x210 net/socket.c:2795 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] __do_fast_syscall_32+0xe7/0x970 arch/x86/entry/syscall_32.c:307 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e The buggy address belongs to the object at ffff888029597000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 19 bytes to the right of allocated 640-byte region [ffff888029597000, ffff888029597280) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x29590 head: order:3 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 ffff88801bc42dc0 dead000000000100 dead000000000122 raw: 0000000000000000 0000000800100010 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff88801bc42dc0 dead000000000100 dead000000000122 head: 0000000000000000 0000000800100010 00000000f5000000 0000000000000000 head: 00fff00000000003 fffffffffffffe01 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 0x252800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP|__GFP_THISNODE), pid 6051, tgid 6045 (syz.0.30), ts 61753541031, free_ts 60933937423 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1859 prep_new_page mm/page_alloc.c:1867 [inline] get_page_from_freelist+0xf48/0x3530 mm/page_alloc.c:3946 __alloc_pages_slowpath mm/page_alloc.c:4821 [inline] __alloc_frozen_pages_noprof+0x6ab/0x2dc0 mm/page_alloc.c:5317 alloc_slab_page mm/slub.c:3266 [inline] allocate_slab mm/slub.c:3380 [inline] new_slab+0xa2/0x640 mm/slub.c:3426 ___slab_alloc+0x5d1/0x800 mm/slub.c:4463 slab_alloc_node mm/slub.c:4908 [inline] __kmalloc_cache_node_noprof+0x391/0x6c0 mm/slub.c:5504 _kmalloc_node_noprof include/linux/slab.h:1193 [inline] shrinker_unit_alloc mm/shrinker.c:50 [inline] alloc_shrinker_info+0x192/0x470 mm/shrinker.c:99 mem_cgroup_css_online+0xa4/0xbf0 mm/memcontrol.c:4222 online_css+0xb2/0x350 kernel/cgroup/cgroup.c:5793 css_create kernel/cgroup/cgroup.c:5871 [inline] cgroup_apply_control_enable+0xa8d/0xdd0 kernel/cgroup/cgroup.c:3385 cgroup_mkdir+0x57f/0x1330 kernel/cgroup/cgroup.c:6072 kernfs_iop_mkdir+0x111/0x190 fs/kernfs/dir.c:1305 vfs_mkdir+0x364/0x850 fs/namei.c:5410 filename_mkdirat+0x48b/0x5e0 fs/namei.c:5443 __do_sys_mkdirat fs/namei.c:5464 [inline] __se_sys_mkdirat fs/namei.c:5461 [inline] __ia32_sys_mkdirat+0x88/0xc0 fs/namei.c:5461 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] __do_fast_syscall_32+0xe7/0x970 arch/x86/entry/syscall_32.c:307 page last free pid 5732 tgid 5732 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] __free_pages_prepare mm/page_alloc.c:1406 [inline] __free_frozen_pages+0x79f/0x1090 mm/page_alloc.c:2950 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:4584 [inline] slab_alloc_node mm/slub.c:4917 [inline] __do_kmalloc_node mm/slub.c:5333 [inline] __kmalloc_noprof+0x2bf/0x820 mm/slub.c:5359 _kmalloc_noprof include/linux/slab.h:992 [inline] _kzalloc_noprof include/linux/slab.h:1309 [inline] tomoyo_encode2+0xfb/0x3c0 security/tomoyo/realpath.c:45 tomoyo_encode+0x29/0x50 security/tomoyo/realpath.c:80 tomoyo_path_perm+0x3a7/0x460 security/tomoyo/file.c:836 tomoyo_path_symlink+0x97/0xe0 security/tomoyo/tomoyo.c:212 security_path_symlink+0x152/0x2d0 security/security.c:1502 filename_symlinkat+0x122/0x560 fs/namei.c:5817 __do_sys_symlink fs/namei.c:5846 [inline] __se_sys_symlink fs/namei.c:5842 [inline] __x64_sys_symlink+0x79/0xb0 fs/namei.c:5842 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x840 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888029597180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888029597200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888029597280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff888029597300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888029597380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== ---------------- Code disassembly (best guess), 2 bytes skipped: 0: 00 00 add %al,(%rax) 2: 41 c7 87 20 0e 00 00 movl $0x0,0xe20(%r15) 9: 00 00 00 00 d: e9 47 04 00 00 jmp 0x459 12: 49 8d 7f 48 lea 0x48(%r15),%rdi 16: e8 00 0c e8 09 call 0x9e80c1b 1b: e8 ab 93 3c 00 call 0x3c93cb 20: fb sti 21: 48 8d bb 00 17 00 00 lea 0x1700(%rbx),%rdi * 28: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax <-- trapping instruction 2f: fc ff df 32: 48 89 fa mov %rdi,%rdx 35: 48 c1 ea 03 shr $0x3,%rdx 39: 0f b6 04 02 movzbl (%rdx,%rax,1),%eax 3d: 84 .byte 0x84