================================================================== BUG: KASAN: slab-use-after-free in __hlist_del include/linux/list.h:901 [inline] BUG: KASAN: slab-use-after-free in detach_timer kernel/time/timer.c:880 [inline] BUG: KASAN: slab-use-after-free in expire_timers+0x476/0x4b0 kernel/time/timer.c:1734 Write of size 8 at addr ffff88804141d500 by task udevd/1451 CPU: 1 PID: 1451 Comm: udevd Not tainted 6.3.0-syzkaller-04626-g0cfd8703e7da #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+0xd9/0x150 lib/dump_stack.c:106 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:319 print_report mm/kasan/report.c:430 [inline] kasan_report+0x11c/0x130 mm/kasan/report.c:536 __hlist_del include/linux/list.h:901 [inline] detach_timer kernel/time/timer.c:880 [inline] expire_timers+0x476/0x4b0 kernel/time/timer.c:1734 __run_timers kernel/time/timer.c:2022 [inline] __run_timers kernel/time/timer.c:1995 [inline] run_timer_softirq+0x326/0x910 kernel/time/timer.c:2035 __do_softirq+0x1d4/0x905 kernel/softirq.c:571 invoke_softirq kernel/softirq.c:445 [inline] __irq_exit_rcu+0x114/0x190 kernel/softirq.c:650 irq_exit_rcu+0x9/0x20 kernel/softirq.c:662 sysvec_apic_timer_interrupt+0x97/0xc0 arch/x86/kernel/apic/apic.c:1106 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645 RIP: 0010:finish_task_switch.isra.0+0x2bf/0xc80 kernel/sched/core.c:5186 Code: 8b 3a 4c 89 e7 48 c7 02 00 00 00 00 ff d1 4d 85 ff 75 bf 4c 89 e7 e8 60 f8 ff ff e8 bb ca 31 00 fb 65 48 8b 1c 25 00 b9 03 00 <48> 8d bb e0 15 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 RSP: 0018:ffffc900002ff9d8 EFLAGS: 00000202 RAX: 0000000000002b0d RBX: ffff8880405cc100 RCX: 1ffffffff22a1e2e RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000 RBP: ffffc900002ffa20 R08: 0000000000000001 R09: ffffffff914cbc77 R10: 0000000000000001 R11: 0000000000000000 R12: ffff8880b993c300 R13: ffff888074dc4180 R14: 0000000000000000 R15: ffff8880b993cd38 context_switch kernel/sched/core.c:5310 [inline] __schedule+0xc99/0x5770 kernel/sched/core.c:6625 preempt_schedule_irq+0x52/0x90 kernel/sched/core.c:6937 irqentry_exit+0x35/0x80 kernel/entry/common.c:433 asm_sysvec_reschedule_ipi+0x1a/0x20 arch/x86/include/asm/idtentry.h:650 RIP: 0010:__sanitizer_cov_trace_const_cmp1+0x8/0x20 kernel/kcov.c:290 Code: 00 00 f3 0f 1e fa 48 8b 0c 24 48 89 f2 48 89 fe bf 06 00 00 00 e9 f8 fe ff ff 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 48 8b 0c 24 <40> 0f b6 d6 40 0f b6 f7 bf 01 00 00 00 e9 d6 fe ff ff 66 0f 1f 44 RSP: 0018:ffffc900002ffc88 EFLAGS: 00000246 RAX: 0000000000000001 RBX: 0000000000000001 RCX: ffffffff81f60245 RDX: ffff88807d2c6d30 RSI: 0000000000000001 RDI: 0000000000000000 RBP: ffff88807e008860 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000019 R11: 0000000000000000 R12: ffff88807e008858 R13: ffff88807d2c6d30 R14: ffff88807e008840 R15: dffffc0000000000 __list_add include/linux/list.h:69 [inline] list_add_tail include/linux/list.h:102 [inline] ep_send_events fs/eventpoll.c:1721 [inline] ep_poll fs/eventpoll.c:1823 [inline] do_epoll_wait+0xbf5/0x1980 fs/eventpoll.c:2271 __do_sys_epoll_wait fs/eventpoll.c:2283 [inline] __se_sys_epoll_wait fs/eventpoll.c:2278 [inline] __x64_sys_epoll_wait+0x15c/0x280 fs/eventpoll.c:2278 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fb58d362457 Code: 73 01 c3 48 8b 0d d1 d9 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 20 b8 e8 00 00 00 0f 05 <48> 3d 00 f0 ff ff 76 76 48 8b 15 a2 d9 0c 00 f7 d8 64 89 02 48 83 RSP: 002b:00007fff0cd6fba8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e8 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fb58d362457 RDX: 0000000000000004 RSI: 00007fff0cd6fbe8 RDI: 0000000000000004 RBP: 0000563978ce90c0 R08: 0000000000000007 R09: e93dd89f2c923897 R10: 00000000ffffffff R11: 0000000000000246 R12: 0000563978ce89b0 R13: 00007fff0cd6fbe8 R14: 0000000000000008 R15: 0000563978ca52c0 Allocated by task 28730: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] ____kasan_kmalloc mm/kasan/common.c:333 [inline] __kasan_kmalloc+0xa3/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+0x61/0x1a0 mm/slab_common.c:973 kmalloc_node include/linux/slab.h:580 [inline] kvmalloc_node+0x76/0x1a0 mm/util.c:603 kvmalloc include/linux/slab.h:698 [inline] kvzalloc include/linux/slab.h:706 [inline] alloc_netdev_mqs+0x9c/0x1250 net/core/dev.c:10588 rtnl_create_link+0xbeb/0xee0 net/core/rtnetlink.c:3312 rtnl_newlink_create net/core/rtnetlink.c:3430 [inline] __rtnl_newlink+0xfd4/0x1840 net/core/rtnetlink.c:3657 rtnl_newlink+0x68/0xa0 net/core/rtnetlink.c:3670 rtnetlink_rcv_msg+0x43d/0xd50 net/core/rtnetlink.c:6181 netlink_rcv_skb+0x165/0x440 net/netlink/af_netlink.c:2577 netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline] netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1365 netlink_sendmsg+0x925/0xe30 net/netlink/af_netlink.c:1942 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg+0xde/0x190 net/socket.c:747 __sys_sendto+0x23a/0x340 net/socket.c:2142 __do_sys_sendto net/socket.c:2154 [inline] __se_sys_sendto net/socket.c:2150 [inline] __x64_sys_sendto+0xe1/0x1b0 net/socket.c:2150 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 13962: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:521 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x13b/0x1a0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] __cache_free mm/slab.c:3390 [inline] __do_kmem_cache_free mm/slab.c:3577 [inline] __kmem_cache_free+0xcd/0x2c0 mm/slab.c:3584 kvfree+0x46/0x50 mm/util.c:649 device_release+0xa3/0x240 drivers/base/core.c:2436 kobject_cleanup lib/kobject.c:681 [inline] kobject_release lib/kobject.c:712 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1c2/0x4d0 lib/kobject.c:729 netdev_run_todo+0x762/0x1100 net/core/dev.c:10362 default_device_exit_batch+0x456/0x5b0 net/core/dev.c:11354 ops_exit_list+0x125/0x170 net/core/net_namespace.c:175 cleanup_net+0x4ee/0xb10 net/core/net_namespace.c:614 process_one_work+0x991/0x15c0 kernel/workqueue.c:2390 worker_thread+0x669/0x1090 kernel/workqueue.c:2537 kthread+0x33e/0x440 kernel/kthread.c:379 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 Last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0x7b/0x90 mm/kasan/generic.c:491 insert_work+0x48/0x350 kernel/workqueue.c:1361 __queue_work+0x625/0x1120 kernel/workqueue.c:1524 call_timer_fn+0x1a0/0x580 kernel/time/timer.c:1700 expire_timers+0xbc/0x4b0 kernel/time/timer.c:1746 __run_timers kernel/time/timer.c:2022 [inline] __run_timers kernel/time/timer.c:1995 [inline] run_timer_softirq+0x326/0x910 kernel/time/timer.c:2035 __do_softirq+0x1d4/0x905 kernel/softirq.c:571 Second to last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0x7b/0x90 mm/kasan/generic.c:491 insert_work+0x48/0x350 kernel/workqueue.c:1361 __queue_work+0x625/0x1120 kernel/workqueue.c:1524 call_timer_fn+0x1a0/0x580 kernel/time/timer.c:1700 expire_timers+0xbc/0x4b0 kernel/time/timer.c:1746 __run_timers kernel/time/timer.c:2022 [inline] __run_timers kernel/time/timer.c:1995 [inline] run_timer_softirq+0x326/0x910 kernel/time/timer.c:2035 __do_softirq+0x1d4/0x905 kernel/softirq.c:571 The buggy address belongs to the object at ffff88804141c000 which belongs to the cache kmalloc-cg-8k of size 8192 The buggy address is located 5376 bytes inside of freed 8192-byte region [ffff88804141c000, ffff88804141e000) The buggy address belongs to the physical page: page:ffffea0001050700 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4141c head:ffffea0001050700 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff88801df88f81 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffff88801244db00 ffffea0000d40610 ffffea0000bb1e10 raw: 0000000000000000 ffff88804141c000 0000000100000001 ffff88801df88f81 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0x3460c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_RETRY_MAYFAIL|__GFP_COMP|__GFP_HARDWALL|__GFP_THISNODE), pid 28730, tgid 28730 (syz-executor.5), ts 2575171990625, free_ts 2573269858926 prep_new_page mm/page_alloc.c:2553 [inline] get_page_from_freelist+0x1190/0x2e20 mm/page_alloc.c:4326 __alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:5592 __alloc_pages_node include/linux/gfp.h:237 [inline] kmem_getpages mm/slab.c:1360 [inline] cache_grow_begin+0x9b/0x3b0 mm/slab.c:2570 cache_alloc_refill+0x27f/0x380 mm/slab.c:2943 ____cache_alloc mm/slab.c:3019 [inline] ____cache_alloc mm/slab.c:3002 [inline] __do_cache_alloc mm/slab.c:3202 [inline] slab_alloc_node mm/slab.c:3250 [inline] __kmem_cache_alloc_node+0x360/0x3f0 mm/slab.c:3541 __do_kmalloc_node mm/slab_common.c:965 [inline] __kmalloc_node+0x51/0x1a0 mm/slab_common.c:973 kmalloc_node include/linux/slab.h:580 [inline] kvmalloc_node+0x76/0x1a0 mm/util.c:603 kvmalloc include/linux/slab.h:698 [inline] kvzalloc include/linux/slab.h:706 [inline] alloc_netdev_mqs+0x9c/0x1250 net/core/dev.c:10588 rtnl_create_link+0xbeb/0xee0 net/core/rtnetlink.c:3312 rtnl_newlink_create net/core/rtnetlink.c:3430 [inline] __rtnl_newlink+0xfd4/0x1840 net/core/rtnetlink.c:3657 rtnl_newlink+0x68/0xa0 net/core/rtnetlink.c:3670 rtnetlink_rcv_msg+0x43d/0xd50 net/core/rtnetlink.c:6181 netlink_rcv_skb+0x165/0x440 net/netlink/af_netlink.c:2577 netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline] netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1365 netlink_sendmsg+0x925/0xe30 net/netlink/af_netlink.c:1942 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg+0xde/0x190 net/socket.c:747 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1454 [inline] free_pcp_prepare+0x5d5/0xa50 mm/page_alloc.c:1504 free_unref_page_prepare mm/page_alloc.c:3388 [inline] free_unref_page+0x1d/0x490 mm/page_alloc.c:3483 slab_destroy mm/slab.c:1613 [inline] slabs_destroy+0x85/0xc0 mm/slab.c:1633 cache_flusharray mm/slab.c:3361 [inline] ___cache_free+0x2ae/0x3d0 mm/slab.c:3424 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x4f/0x1a0 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x195/0x220 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x63/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook mm/slab.h:710 [inline] slab_alloc_node mm/slab.c:3257 [inline] slab_alloc mm/slab.c:3266 [inline] __kmem_cache_alloc_lru mm/slab.c:3443 [inline] kmem_cache_alloc+0x1bd/0x3f0 mm/slab.c:3452 mt_alloc_one lib/maple_tree.c:159 [inline] mas_alloc_nodes+0x4dd/0x880 lib/maple_tree.c:1287 mas_node_count_gfp lib/maple_tree.c:1367 [inline] mas_preallocate+0x1bb/0x360 lib/maple_tree.c:5806 vma_iter_prealloc mm/internal.h:972 [inline] mmap_region+0x85c/0x2620 mm/mmap.c:2671 do_mmap+0x831/0xf60 mm/mmap.c:1364 vm_mmap_pgoff+0x1af/0x280 mm/util.c:542 ksys_mmap_pgoff+0x7d/0x5a0 mm/mmap.c:1410 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff88804141d400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88804141d480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88804141d500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88804141d580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88804141d600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 8b 3a mov (%rdx),%edi 2: 4c 89 e7 mov %r12,%rdi 5: 48 c7 02 00 00 00 00 movq $0x0,(%rdx) c: ff d1 callq *%rcx e: 4d 85 ff test %r15,%r15 11: 75 bf jne 0xffffffd2 13: 4c 89 e7 mov %r12,%rdi 16: e8 60 f8 ff ff callq 0xfffff87b 1b: e8 bb ca 31 00 callq 0x31cadb 20: fb sti 21: 65 48 8b 1c 25 00 b9 mov %gs:0x3b900,%rbx 28: 03 00 * 2a: 48 8d bb e0 15 00 00 lea 0x15e0(%rbx),%rdi <-- trapping instruction 31: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax 38: fc ff df 3b: 48 89 fa mov %rdi,%rdx 3e: 48 rex.W 3f: c1 .byte 0xc1