================================================================== BUG: KASAN: stack-out-of-bounds in profile_pc+0xd2/0x170 arch/x86/kernel/time.c:42 Read of size 8 at addr ffffc900041f7b80 by task syz.2.14/5223 CPU: 1 UID: 0 PID: 5223 Comm: syz.2.14 Not tainted 6.10.0-rc5-next-20240627-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 profile_pc+0xd2/0x170 arch/x86/kernel/time.c:42 profile_tick+0xd7/0x150 kernel/profile.c:337 tick_sched_handle kernel/time/tick-sched.c:277 [inline] tick_nohz_handler+0x386/0x500 kernel/time/tick-sched.c:297 __run_hrtimer kernel/time/hrtimer.c:1689 [inline] __hrtimer_run_queues+0x551/0xd50 kernel/time/hrtimer.c:1753 hrtimer_interrupt+0x396/0x990 kernel/time/hrtimer.c:1815 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1032 [inline] __sysvec_apic_timer_interrupt+0x110/0x3f0 arch/x86/kernel/apic/apic.c:1049 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline] sysvec_apic_timer_interrupt+0xa1/0xc0 arch/x86/kernel/apic/apic.c:1043 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0xd8/0x140 kernel/locking/spinlock.c:194 Code: 9c 8f 44 24 20 42 80 3c 23 00 74 08 4c 89 f7 e8 4e 92 5f f6 f6 44 24 21 02 75 52 41 f7 c7 00 02 00 00 74 01 fb bf 01 00 00 00 33 de c7 f5 65 8b 05 74 21 69 74 85 c0 74 43 48 c7 04 24 0e 36 RSP: 0018:ffffc900041f7b80 EFLAGS: 00000206 RAX: 2698c5037ea7e800 RBX: 1ffff9200083ef74 RCX: ffffffff816fd85a RDX: dffffc0000000000 RSI: ffffffff8bcac900 RDI: 0000000000000001 RBP: ffffc900041f7c20 R08: ffffffff93007887 R09: 1ffffffff2600f10 R10: dffffc0000000000 R11: fffffbfff2600f11 R12: dffffc0000000000 R13: 1ffff9200083ef70 R14: ffffc900041f7ba0 R15: 0000000000000246 spin_unlock_irqrestore include/linux/spinlock.h:406 [inline] dummy_pullup+0x18b/0x200 drivers/usb/gadget/udc/dummy_hcd.c:924 usb_gadget_disconnect_locked+0x13c/0x4b0 drivers/usb/gadget/udc/core.c:779 gadget_unbind_driver+0xca/0x460 drivers/usb/gadget/udc/core.c:1668 device_remove drivers/base/dd.c:566 [inline] __device_release_driver drivers/base/dd.c:1272 [inline] device_release_driver_internal+0x4a9/0x7c0 drivers/base/dd.c:1295 driver_detach+0x1fb/0x2d0 drivers/base/dd.c:1358 bus_remove_driver+0x1f3/0x320 drivers/base/bus.c:742 usb_gadget_unregister_driver+0x4e/0x70 drivers/usb/gadget/udc/core.c:1733 raw_release+0xf9/0x1e0 drivers/usb/gadget/legacy/raw_gadget.c:462 __fput+0x24a/0x8a0 fs/file_table.c:422 __do_sys_close fs/open.c:1566 [inline] __se_sys_close fs/open.c:1551 [inline] __x64_sys_close+0x7f/0x110 fs/open.c:1551 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f6ae117488a Code: 48 3d 00 f0 ff ff 77 48 c3 0f 1f 80 00 00 00 00 48 83 ec 18 89 7c 24 0c e8 43 8a 02 00 8b 7c 24 0c 89 c2 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 36 89 d7 89 44 24 0c e8 a3 8a 02 00 8b 44 24 RSP: 002b:00007f6ae1ec0000 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: ffffffffffffffda RBX: 00007f6ae1303fa0 RCX: 00007f6ae117488a RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003 RBP: 00007f6ae11f6756 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000003 R11: 0000000000000293 R12: 0000000000000000 R13: 000000000000000b R14: 00007f6ae1303fa0 R15: 00007ffc9d38ea18 The buggy address belongs to stack of task syz.2.14/5223 and is located at offset 0 in frame: _raw_spin_unlock_irqrestore+0x0/0x140 kernel/locking/spinlock.c:187 This frame has 1 object: [32, 40) 'flags.i.i.i.i' The buggy address belongs to the virtual mapping at [ffffc900041f0000, ffffc900041f9000) created by: copy_process+0x5d1/0x3d70 kernel/fork.c:2205 The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88802b872e58 pfn:0x2b872 memcg:ffff8880251bb402 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000 raw: ffff88802b872e58 0000000000000000 00000001ffffffff ffff8880251bb402 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x102dc2(GFP_HIGHUSER|__GFP_NOWARN|__GFP_ZERO), pid 11, tgid 11 (kworker/u8:0), ts 76561757399, free_ts 76503538291 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1502 prep_new_page mm/page_alloc.c:1510 [inline] get_page_from_freelist+0x2ccb/0x2d80 mm/page_alloc.c:3489 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4747 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2263 vm_area_alloc_pages mm/vmalloc.c:3584 [inline] __vmalloc_area_node mm/vmalloc.c:3660 [inline] __vmalloc_node_range_noprof+0x971/0x1460 mm/vmalloc.c:3841 alloc_thread_stack_node kernel/fork.c:313 [inline] dup_task_struct+0x444/0x8c0 kernel/fork.c:1114 copy_process+0x5d1/0x3d70 kernel/fork.c:2205 kernel_clone+0x226/0x8f0 kernel/fork.c:2788 user_mode_thread+0x132/0x1a0 kernel/fork.c:2866 call_usermodehelper_exec_sync kernel/umh.c:133 [inline] call_usermodehelper_exec_work+0x9b/0x230 kernel/umh.c:164 process_one_work kernel/workqueue.c:3224 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3305 worker_thread+0x86d/0xd40 kernel/workqueue.c:3383 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:144 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 page last free pid 5151 tgid 5151 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1094 [inline] free_unref_page+0xd22/0xea0 mm/page_alloc.c:2653 discard_slab mm/slub.c:2562 [inline] __put_partials+0xeb/0x130 mm/slub.c:3030 put_cpu_partial+0x17c/0x250 mm/slub.c:3105 __slab_free+0x2ea/0x3d0 mm/slub.c:4343 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x9e/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:322 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3975 [inline] slab_alloc_node mm/slub.c:4037 [inline] kmem_cache_alloc_node_noprof+0x16b/0x320 mm/slub.c:4080 __alloc_skb+0x1c3/0x440 net/core/skbuff.c:664 netlink_sendmsg+0x638/0xcb0 net/netlink/af_netlink.c:1876 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x221/0x270 net/socket.c:745 ____sys_sendmsg+0x525/0x7d0 net/socket.c:2597 ___sys_sendmsg net/socket.c:2651 [inline] __sys_sendmsg+0x2b0/0x3a0 net/socket.c:2680 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffffc900041f7a80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffffc900041f7b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffffc900041f7b80: f1 f1 f1 f1 00 f3 f3 f3 00 00 00 00 00 00 00 00 ^ ffffc900041f7c00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffffc900041f7c80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== ---------------- Code disassembly (best guess): 0: 9c pushf 1: 8f 44 24 20 pop 0x20(%rsp) 5: 42 80 3c 23 00 cmpb $0x0,(%rbx,%r12,1) a: 74 08 je 0x14 c: 4c 89 f7 mov %r14,%rdi f: e8 4e 92 5f f6 call 0xf65f9262 14: f6 44 24 21 02 testb $0x2,0x21(%rsp) 19: 75 52 jne 0x6d 1b: 41 f7 c7 00 02 00 00 test $0x200,%r15d 22: 74 01 je 0x25 24: fb sti 25: bf 01 00 00 00 mov $0x1,%edi * 2a: e8 33 de c7 f5 call 0xf5c7de62 <-- trapping instruction 2f: 65 8b 05 74 21 69 74 mov %gs:0x74692174(%rip),%eax # 0x746921aa 36: 85 c0 test %eax,%eax 38: 74 43 je 0x7d 3a: 48 rex.W 3b: c7 .byte 0xc7 3c: 04 24 add $0x24,%al 3e: 0e (bad) 3f: 36 ss