================================================================== 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 ffff8880566434e8 by task acpid/5119 CPU: 3 UID: 0 PID: 5119 Comm: acpid 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/0x3700 drivers/usb/gadget/udc/dummy_hcd.c:1890 __run_hrtimer kernel/time/hrtimer.c:2067 [inline] __hrtimer_run_queues+0x462/0x9c0 kernel/time/hrtimer.c:2124 hrtimer_run_softirq+0x1ca/0x360 kernel/time/hrtimer.c:2141 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+0x194/0x210 kernel/softirq.c:767 irq_exit_rcu+0x9/0x30 kernel/softirq.c:784 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:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:211 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x31/0x80 kernel/locking/spinlock.c:221 Code: f5 53 48 8b 74 24 10 48 89 fb 48 83 c7 18 e8 86 7e 1c f6 48 89 df e8 9e d4 1c f6 f7 c5 00 02 00 00 75 23 9c 58 f6 c4 02 75 37 01 00 00 00 e8 c5 dd 0b f6 65 48 83 3d 64 05 be 08 00 74 16 5b RSP: 0018:ffffc900037f76f0 EFLAGS: 00000246 RAX: 0000000000000002 RBX: ffff88802ba28000 RCX: 0000000000000040 RDX: 0000000000000001 RSI: ffffffff8e3d3fc0 RDI: ffffffff8c615f80 RBP: 0000000000000246 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: 00000000c0000000 R13: ffff88802c865478 R14: 0000000000000000 R15: ffff88802c865400 spin_unlock_irqrestore include/linux/spinlock.h:425 [inline] dummy_urb_enqueue+0x56c/0x880 drivers/usb/gadget/udc/dummy_hcd.c:1337 usb_hcd_submit_urb+0x268/0x2150 drivers/usb/core/hcd.c:1542 usb_submit_urb+0x827/0x19b0 drivers/usb/core/urb.c:586 usbtouch_start_io drivers/input/touchscreen/usbtouchscreen.c:1335 [inline] usbtouch_open+0x25b/0x310 drivers/input/touchscreen/usbtouchscreen.c:1355 input_start_device drivers/input/input.c:621 [inline] input_open_device+0x2ac/0x660 drivers/input/input.c:659 mousedev_open_device+0xe2/0x140 drivers/input/mousedev.c:430 mousedev_open+0x2fd/0x580 drivers/input/mousedev.c:556 chrdev_open+0x234/0x6a0 fs/char_dev.c:411 do_dentry_open+0x6ab/0x14d0 fs/open.c:996 vfs_open+0x82/0x3f0 fs/open.c:1101 do_open fs/namei.c:4837 [inline] path_openat+0x19fa/0x2440 fs/namei.c:5000 do_file_open+0x20e/0x430 fs/namei.c:5029 do_sys_openat2+0x10f/0x1e0 fs/open.c:1417 do_sys_open fs/open.c:1423 [inline] __do_sys_openat fs/open.c:1439 [inline] __se_sys_openat fs/open.c:1434 [inline] __x64_sys_openat+0x12d/0x210 fs/open.c:1434 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 RIP: 0033:0x7f337d23e407 Code: 48 89 fa 4c 89 df e8 38 aa 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff RSP: 002b:00007ffc1eb46fc0 EFLAGS: 00000202 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f337d1b4780 RCX: 00007f337d23e407 RDX: 0000000000080800 RSI: 00007ffc1eb471d0 RDI: ffffffffffffff9c RBP: 00007ffc1eb471d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000040 R13: 00007ffc1eb472d0 R14: 00005611d36b97fe R15: 00007ffc1eb472d0 Allocated by task 10639: 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:5337 [inline] __kmalloc_noprof+0x324/0x820 mm/slub.c:5362 _kmalloc_noprof include/linux/slab.h:992 [inline] _kzalloc_noprof include/linux/slab.h:1309 [inline] fib6_info_alloc+0x40/0x160 net/ipv6/ip6_fib.c:155 ip6_route_info_create+0x14c/0xad0 net/ipv6/route.c:3833 ip6_route_add+0x4b/0x1d0 net/ipv6/route.c:3962 addrconf_add_mroute+0x1de/0x350 net/ipv6/addrconf.c:2568 addrconf_add_dev+0x14e/0x1a0 net/ipv6/addrconf.c:2586 inet6_addr_add+0xfc/0x9a0 net/ipv6/addrconf.c:3056 inet6_rtm_newaddr+0x147a/0x1bb0 net/ipv6/addrconf.c:5095 rtnetlink_rcv_msg+0x95e/0xe90 net/core/rtnetlink.c:7132 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_sendto+0x48b/0x4e0 net/socket.c:2281 __do_sys_sendto net/socket.c:2288 [inline] __se_sys_sendto net/socket.c:2284 [inline] __x64_sys_sendto+0xe0/0x1c0 net/socket.c:2284 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 57: 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:2678 [inline] slab_free mm/slub.c:6372 [inline] kfree+0x22b/0x6c0 mm/slub.c:6687 rcu_do_batch kernel/rcu/tree.c:2645 [inline] rcu_core+0x5a2/0x10e0 kernel/rcu/tree.c:2897 handle_softirqs+0x1e6/0x9d0 kernel/softirq.c:645 do_softirq kernel/softirq.c:546 [inline] do_softirq+0xaf/0xf0 kernel/softirq.c:533 __local_bh_enable_ip+0xff/0x120 kernel/softirq.c:473 local_bh_enable include/linux/bottom_half.h:33 [inline] __alloc_skb+0x5db/0x710 net/core/skbuff.c:699 alloc_skb include/linux/skbuff.h:1384 [inline] mld_newpack.isra.0+0x18e/0xa20 net/ipv6/mcast.c:1790 add_grhead+0x299/0x340 net/ipv6/mcast.c:1901 add_grec+0x1389/0x1930 net/ipv6/mcast.c:2040 mld_send_cr net/ipv6/mcast.c:2165 [inline] mld_ifc_work+0x3c5/0xc10 net/ipv6/mcast.c:2711 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3387 process_scheduled_works kernel/workqueue.c:3470 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3551 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 Last potentially related work creation: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_record_aux_stack+0xa7/0xc0 mm/kasan/generic.c:556 __call_rcu_common.constprop.0+0xa5/0x9b0 kernel/rcu/tree.c:3159 call_rcu_hurry include/linux/rcupdate.h:125 [inline] fib6_info_release include/net/ip6_fib.h:344 [inline] fib6_info_release include/net/ip6_fib.h:340 [inline] ip6_route_info_create_nh+0x981/0xfe0 net/ipv6/route.c:3943 ip6_route_add+0x80/0x1d0 net/ipv6/route.c:3966 addrconf_add_mroute+0x1de/0x350 net/ipv6/addrconf.c:2568 addrconf_add_dev+0x14e/0x1a0 net/ipv6/addrconf.c:2586 inet6_addr_add+0xfc/0x9a0 net/ipv6/addrconf.c:3056 inet6_rtm_newaddr+0x147a/0x1bb0 net/ipv6/addrconf.c:5095 rtnetlink_rcv_msg+0x95e/0xe90 net/core/rtnetlink.c:7132 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_sendto+0x48b/0x4e0 net/socket.c:2281 __do_sys_sendto net/socket.c:2288 [inline] __se_sys_sendto net/socket.c:2284 [inline] __x64_sys_sendto+0xe0/0x1c0 net/socket.c:2284 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 The buggy address belongs to the object at ffff888056643400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 232 bytes inside of freed 512-byte region [ffff888056643400, ffff888056643600) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888056642000 pfn:0x56640 head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000240(workingset|head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000240 ffff88801c042c80 ffffea00015a2e10 ffffea0000fa8010 raw: ffff888056642000 0000000800100008 00000000f5000000 0000000000000000 head: 00fff00000000240 ffff88801c042c80 ffffea00015a2e10 ffffea0000fa8010 head: ffff888056642000 0000000800100008 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 5730, tgid 5730 (syz-executor), ts 49757414029 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/0x35b0 mm/page_alloc.c:3943 __alloc_frozen_pages_noprof+0x2eb/0x3300 mm/page_alloc.c:5436 alloc_slab_page mm/slub.c:3267 [inline] allocate_slab mm/slub.c:3382 [inline] new_slab+0xa5/0x640 mm/slub.c:3428 refill_objects+0xe3/0x410 mm/slub.c:7305 refill_sheaf mm/slub.c:2805 [inline] __pcs_replace_empty_main+0x372/0x680 mm/slub.c:4677 alloc_from_pcs mm/slub.c:4775 [inline] slab_alloc_node mm/slub.c:4907 [inline] __do_kmalloc_node mm/slub.c:5336 [inline] __kmalloc_noprof+0x66b/0x820 mm/slub.c:5362 _kmalloc_noprof include/linux/slab.h:992 [inline] _kzalloc_noprof include/linux/slab.h:1309 [inline] fib6_info_alloc+0x40/0x160 net/ipv6/ip6_fib.c:155 ip6_route_info_create+0x14c/0xad0 net/ipv6/route.c:3833 ip6_route_add+0x4b/0x1d0 net/ipv6/route.c:3962 addrconf_prefix_route+0x2fb/0x510 net/ipv6/addrconf.c:2504 inet6_addr_add+0x575/0x9a0 net/ipv6/addrconf.c:3077 inet6_rtm_newaddr+0x147a/0x1bb0 net/ipv6/addrconf.c:5095 rtnetlink_rcv_msg+0x95e/0xe90 net/core/rtnetlink.c:7132 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 page_owner free stack trace missing Memory state around the buggy address: ffff888056643380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888056643400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888056643480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888056643500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888056643580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: f5 cmc 1: 53 push %rbx 2: 48 8b 74 24 10 mov 0x10(%rsp),%rsi 7: 48 89 fb mov %rdi,%rbx a: 48 83 c7 18 add $0x18,%rdi e: e8 86 7e 1c f6 call 0xf61c7e99 13: 48 89 df mov %rbx,%rdi 16: e8 9e d4 1c f6 call 0xf61cd4b9 1b: f7 c5 00 02 00 00 test $0x200,%ebp 21: 75 23 jne 0x46 23: 9c pushf 24: 58 pop %rax 25: f6 c4 02 test $0x2,%ah 28: 75 37 jne 0x61 * 2a: bf 01 00 00 00 mov $0x1,%edi <-- trapping instruction 2f: e8 c5 dd 0b f6 call 0xf60bddf9 34: 65 48 83 3d 64 05 be cmpq $0x0,%gs:0x8be0564(%rip) # 0x8be05a1 3b: 08 00 3d: 74 16 je 0x55 3f: 5b pop %rbx