================================================================== BUG: KASAN: slab-use-after-free in __hlist_del include/linux/list.h:901 [inline] BUG: KASAN: slab-use-after-free in detach_timer+0x14d/0x2f0 kernel/time/timer.c:880 Write of size 8 at addr ffff888085919500 by task udevd/7905 CPU: 1 PID: 7905 Comm: udevd Not tainted 6.3.0-syzkaller-13091-g3c4aa4434377 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:351 [inline] print_report+0x163/0x540 mm/kasan/report.c:462 kasan_report+0x176/0x1b0 mm/kasan/report.c:572 __hlist_del include/linux/list.h:901 [inline] detach_timer+0x14d/0x2f0 kernel/time/timer.c:880 expire_timers kernel/time/timer.c:1734 [inline] __run_timers+0x5d4/0x860 kernel/time/timer.c:2022 run_timer_softirq+0x67/0xf0 kernel/time/timer.c:2035 __do_softirq+0x2ab/0x908 kernel/softirq.c:571 invoke_softirq kernel/softirq.c:445 [inline] __irq_exit_rcu+0x159/0x240 kernel/softirq.c:650 irq_exit_rcu+0x9/0x20 kernel/softirq.c:662 sysvec_apic_timer_interrupt+0x95/0xb0 arch/x86/kernel/apic/apic.c:1106 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645 RIP: 0010:check_kcov_mode kernel/kcov.c:184 [inline] RIP: 0010:write_comp_data kernel/kcov.c:236 [inline] RIP: 0010:__sanitizer_cov_trace_const_cmp1+0x34/0x90 kernel/kcov.c:290 Code: 8b 15 10 25 78 7e 65 8b 05 11 25 78 7e a9 00 01 ff 00 74 10 a9 00 01 00 00 74 5b 83 ba 0c 16 00 00 00 74 52 8b 82 e8 15 00 00 <83> f8 03 75 47 48 8b 8a f0 15 00 00 44 8b 8a ec 15 00 00 49 c1 e1 RSP: 0018:ffffc900037bf950 EFLAGS: 00000246 RAX: 0000000000000000 RBX: ffff8880b7d68000 RCX: dffffc0000000000 RDX: ffff88802d373b80 RSI: 000000000000002e RDI: 0000000000000040 RBP: ffff888037d68fe6 R08: ffffffff813dd2fa R09: fffffbfff1cab85e R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000fff R13: ffff888037d68000 R14: 0000000037d68000 R15: 000000000000002e phys_addr_valid arch/x86/mm/physaddr.h:7 [inline] __phys_addr+0x8a/0x170 arch/x86/mm/physaddr.c:28 virt_to_folio include/linux/mm.h:1178 [inline] kfree+0x43/0x1a0 mm/slab_common.c:1007 tomoyo_realpath_from_path+0x5a3/0x5e0 security/tomoyo/realpath.c:286 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x28d/0x700 security/tomoyo/file.c:822 security_inode_getattr+0xd3/0x120 security/security.c:2114 vfs_getattr fs/stat.c:167 [inline] vfs_statx+0x18f/0x480 fs/stat.c:242 vfs_fstatat fs/stat.c:276 [inline] __do_sys_newfstatat fs/stat.c:446 [inline] __se_sys_newfstatat fs/stat.c:440 [inline] __x64_sys_newfstatat+0x14f/0x1d0 fs/stat.c:440 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f769b3165f4 Code: 64 c7 00 09 00 00 00 83 c8 ff c3 48 89 f2 b9 00 01 00 00 48 89 fe bf 9c ff ff ff e9 00 00 00 00 41 89 ca b8 06 01 00 00 0f 05 <45> 31 c0 3d 00 f0 ff ff 76 10 48 8b 15 03 a8 0d 00 f7 d8 41 83 c8 RSP: 002b:00007ffce397e0f8 EFLAGS: 00000206 ORIG_RAX: 0000000000000106 RAX: ffffffffffffffda RBX: 00007f769b3ee460 RCX: 00007f769b3165f4 RDX: 00007ffce397e100 RSI: 00007f769b3b3130 RDI: 0000000000000009 RBP: 000055be015eb0d0 R08: 0000000000000000 R09: 0000000000000001 R10: 0000000000001000 R11: 0000000000000206 R12: 0000000000000002 R13: 0000000000000002 R14: 000055be015eb0d0 R15: 000055be00d6dea6 Allocated by task 30275: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4f/0x70 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:196 [inline] __do_kmalloc_node mm/slab_common.c:966 [inline] __kmalloc_node+0xb8/0x230 mm/slab_common.c:973 kmalloc_node include/linux/slab.h:579 [inline] kvmalloc_node+0x72/0x180 mm/util.c:604 kvmalloc include/linux/slab.h:697 [inline] kvzalloc include/linux/slab.h:705 [inline] alloc_netdev_mqs+0x89/0xf30 net/core/dev.c:10626 rtnl_create_link+0x2f7/0xc00 net/core/rtnetlink.c:3315 rtnl_newlink_create net/core/rtnetlink.c:3433 [inline] __rtnl_newlink net/core/rtnetlink.c:3660 [inline] rtnl_newlink+0x1379/0x2010 net/core/rtnetlink.c:3673 rtnetlink_rcv_msg+0x825/0xf40 net/core/rtnetlink.c:6395 netlink_rcv_skb+0x1df/0x430 net/netlink/af_netlink.c:2546 netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline] netlink_unicast+0x7c3/0x990 net/netlink/af_netlink.c:1365 netlink_sendmsg+0xa2a/0xd60 net/netlink/af_netlink.c:1913 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg net/socket.c:747 [inline] ____sys_sendmsg+0x58f/0x890 net/socket.c:2503 ___sys_sendmsg net/socket.c:2557 [inline] __sys_sendmsg+0x2ad/0x390 net/socket.c:2586 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:491 insert_work+0x54/0x3d0 kernel/workqueue.c:1365 __queue_work+0xb37/0xf10 kernel/workqueue.c:1526 call_timer_fn+0x178/0x580 kernel/time/timer.c:1700 expire_timers kernel/time/timer.c:1746 [inline] __run_timers+0x67a/0x860 kernel/time/timer.c:2022 run_timer_softirq+0x67/0xf0 kernel/time/timer.c:2035 __do_softirq+0x2ab/0x908 kernel/softirq.c:571 Second to last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:491 insert_work+0x54/0x3d0 kernel/workqueue.c:1365 __queue_work+0xb37/0xf10 kernel/workqueue.c:1526 call_timer_fn+0x178/0x580 kernel/time/timer.c:1700 expire_timers kernel/time/timer.c:1746 [inline] __run_timers+0x67a/0x860 kernel/time/timer.c:2022 run_timer_softirq+0x67/0xf0 kernel/time/timer.c:2035 __do_softirq+0x2ab/0x908 kernel/softirq.c:571 The buggy address belongs to the object at ffff888085918000 which belongs to the cache kmalloc-cg-8k of size 8192 The buggy address is located 5376 bytes inside of freed 8192-byte region [ffff888085918000, ffff88808591a000) The buggy address belongs to the physical page: page:ffffea0002164600 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888085918000 pfn:0x85918 head:ffffea0002164600 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff88801efe3121 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000010200 ffff88801244f640 ffffea000054b210 ffffea0000e54810 raw: ffff888085918000 0000000000020000 00000001ffffffff ffff88801efe3121 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d60c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_RETRY_MAYFAIL|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 30275, tgid 30217 (syz-executor.4), ts 1565372236837, free_ts 1564410907123 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1731 prep_new_page mm/page_alloc.c:1738 [inline] get_page_from_freelist+0x321c/0x33a0 mm/page_alloc.c:3502 __alloc_pages+0x255/0x670 mm/page_alloc.c:4768 alloc_slab_page+0x6a/0x160 mm/slub.c:1851 allocate_slab mm/slub.c:1998 [inline] new_slab+0x84/0x2f0 mm/slub.c:2051 ___slab_alloc+0xa85/0x10a0 mm/slub.c:3192 __slab_alloc mm/slub.c:3291 [inline] __slab_alloc_node mm/slub.c:3344 [inline] slab_alloc_node mm/slub.c:3441 [inline] __kmem_cache_alloc_node+0x1b8/0x290 mm/slub.c:3490 __do_kmalloc_node mm/slab_common.c:965 [inline] __kmalloc_node+0xa7/0x230 mm/slab_common.c:973 kmalloc_node include/linux/slab.h:579 [inline] kvmalloc_node+0x72/0x180 mm/util.c:604 kvmalloc include/linux/slab.h:697 [inline] kvzalloc include/linux/slab.h:705 [inline] alloc_netdev_mqs+0x89/0xf30 net/core/dev.c:10626 rtnl_create_link+0x2f7/0xc00 net/core/rtnetlink.c:3315 rtnl_newlink_create net/core/rtnetlink.c:3433 [inline] __rtnl_newlink net/core/rtnetlink.c:3660 [inline] rtnl_newlink+0x1379/0x2010 net/core/rtnetlink.c:3673 rtnetlink_rcv_msg+0x825/0xf40 net/core/rtnetlink.c:6395 netlink_rcv_skb+0x1df/0x430 net/netlink/af_netlink.c:2546 netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline] netlink_unicast+0x7c3/0x990 net/netlink/af_netlink.c:1365 netlink_sendmsg+0xa2a/0xd60 net/netlink/af_netlink.c:1913 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1302 [inline] free_unref_page_prepare+0x903/0xa30 mm/page_alloc.c:2564 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2659 qlist_free_all+0x22/0x60 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x14b/0x160 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x23/0x70 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook+0x68/0x3a0 mm/slab.h:711 slab_alloc_node mm/slub.c:3451 [inline] __kmem_cache_alloc_node+0x14c/0x290 mm/slub.c:3490 kmalloc_trace+0x2a/0xe0 mm/slab_common.c:1057 kmalloc include/linux/slab.h:559 [inline] syslog_print+0x121/0x9b0 kernel/printk/printk.c:1553 do_syslog+0x8c1/0x9b0 kernel/printk/printk.c:1732 __do_sys_syslog kernel/printk/printk.c:1824 [inline] __se_sys_syslog kernel/printk/printk.c:1822 [inline] __x64_sys_syslog+0x7c/0x90 kernel/printk/printk.c:1822 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff888085919400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888085919480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888085919500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888085919580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888085919600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 8b 15 10 25 78 7e mov 0x7e782510(%rip),%edx # 0x7e782516 6: 65 8b 05 11 25 78 7e mov %gs:0x7e782511(%rip),%eax # 0x7e78251e d: a9 00 01 ff 00 test $0xff0100,%eax 12: 74 10 je 0x24 14: a9 00 01 00 00 test $0x100,%eax 19: 74 5b je 0x76 1b: 83 ba 0c 16 00 00 00 cmpl $0x0,0x160c(%rdx) 22: 74 52 je 0x76 24: 8b 82 e8 15 00 00 mov 0x15e8(%rdx),%eax * 2a: 83 f8 03 cmp $0x3,%eax <-- trapping instruction 2d: 75 47 jne 0x76 2f: 48 8b 8a f0 15 00 00 mov 0x15f0(%rdx),%rcx 36: 44 8b 8a ec 15 00 00 mov 0x15ec(%rdx),%r9d 3d: 49 rex.WB 3e: c1 .byte 0xc1 3f: e1 .byte 0xe1