================================================================== BUG: KASAN: use-after-free in tcp_probe_timer net/ipv4/tcp_timer.c:383 [inline] BUG: KASAN: use-after-free in tcp_write_timer_handler+0xb91/0xbc0 net/ipv4/tcp_timer.c:626 Read of size 1 at addr ffff88801f3b0695 by task syz-executor.2/11832 CPU: 1 PID: 11832 Comm: syz-executor.2 Not tainted 5.18.0-rc4-syzkaller-00424-gb2da7df52e16 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0xeb/0x495 mm/kasan/report.c:313 print_report mm/kasan/report.c:429 [inline] kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491 tcp_probe_timer net/ipv4/tcp_timer.c:383 [inline] tcp_write_timer_handler+0xb91/0xbc0 net/ipv4/tcp_timer.c:626 tcp_write_timer+0xa2/0x2b0 net/ipv4/tcp_timer.c:642 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421 expire_timers kernel/time/timer.c:1466 [inline] __run_timers.part.0+0x679/0xa80 kernel/time/timer.c:1737 __run_timers kernel/time/timer.c:1715 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1750 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:637 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1097 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:645 RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x38/0x70 kernel/locking/spinlock.c:194 Code: 74 24 10 e8 2a f1 f0 f7 48 89 ef e8 72 70 f1 f7 81 e3 00 02 00 00 75 25 9c 58 f6 c4 02 75 2d 48 85 db 74 01 fb bf 01 00 00 00 93 8f e4 f7 65 8b 05 3c c4 95 76 85 c0 74 0a 5b 5d c3 e8 70 cc RSP: 0000:ffffc90013dbfa30 EFLAGS: 00000206 RAX: 0000000000000006 RBX: 0000000000000200 RCX: 1ffffffff200de9e RDX: 0000000000000000 RSI: 0000000000000003 RDI: 0000000000000001 RBP: ffff8880748d1050 R08: 0000000000000001 R09: ffffffff90056947 R10: 0000000000000001 R11: 0000000000000000 R12: ffff8880748d1000 R13: 0000000000000001 R14: ffff8880748d1000 R15: 000000000000000f spin_unlock_irqrestore include/linux/spinlock.h:404 [inline] unlock_page_lruvec_irqrestore include/linux/memcontrol.h:1555 [inline] __pagevec_lru_add+0xa34/0x11e0 mm/swap.c:1063 folio_add_lru+0x467/0x6a0 mm/swap.c:467 lru_cache_add_inactive_or_unevictable+0x192/0x520 mm/swap.c:488 wp_page_copy+0x8d9/0x1b00 mm/memory.c:3076 do_wp_page+0x3db/0x2030 mm/memory.c:3334 handle_pte_fault mm/memory.c:4645 [inline] __handle_mm_fault+0x1dc8/0x4150 mm/memory.c:4763 handle_mm_fault+0x1c8/0x790 mm/memory.c:4861 do_user_addr_fault+0x489/0x11c0 arch/x86/mm/fault.c:1397 handle_page_fault arch/x86/mm/fault.c:1484 [inline] exc_page_fault+0x9e/0x180 arch/x86/mm/fault.c:1540 asm_exc_page_fault+0x1e/0x30 arch/x86/include/asm/idtentry.h:570 RIP: 0023:0xf6e1f428 Code: 39 dd 75 ee 8b 44 24 58 89 28 83 c4 3c 5b 5e 5f 5d c3 8b 7c 24 18 e9 9a fd ff ff 8d b4 26 00 00 00 00 8b 44 24 24 8b 7c 24 18 <89> 1c 88 e9 70 fe ff ff 8b 7c 24 50 39 54 24 0c 0f 84 80 00 00 00 RSP: 002b:00000000f748fa70 EFLAGS: 00010246 RAX: 00000000f6f50000 RBX: 000000004137d32c RCX: 000000000000132c RDX: 0000000000000000 RSI: 00000000f6f36000 RDI: 00000000819e9a46 RBP: 00000000f6f50000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 10590: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] __kasan_slab_alloc+0x90/0xc0 mm/kasan/common.c:469 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:749 [inline] slab_alloc_node mm/slub.c:3217 [inline] slab_alloc mm/slub.c:3225 [inline] __kmem_cache_alloc_lru mm/slub.c:3232 [inline] kmem_cache_alloc+0x204/0x3b0 mm/slub.c:3242 kmem_cache_zalloc include/linux/slab.h:704 [inline] net_alloc net/core/net_namespace.c:403 [inline] copy_net_ns+0x125/0x760 net/core/net_namespace.c:458 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 copy_namespaces+0x391/0x450 kernel/nsproxy.c:178 copy_process+0x2f79/0x6fe0 kernel/fork.c:2237 kernel_clone+0xe7/0xab0 kernel/fork.c:2639 __do_compat_sys_ia32_clone+0xac/0xe0 arch/x86/kernel/sys_ia32.c:254 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c Last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 insert_work+0x48/0x350 kernel/workqueue.c:1358 __queue_work+0x62e/0x1140 kernel/workqueue.c:1517 queue_work_on+0xee/0x110 kernel/workqueue.c:1545 queue_work include/linux/workqueue.h:502 [inline] schedule_work include/linux/workqueue.h:563 [inline] xfrm_hash_grow_check net/xfrm/xfrm_state.c:1025 [inline] xfrm_hash_grow_check net/xfrm/xfrm_state.c:1020 [inline] xfrm_state_find+0x4af1/0x4f10 net/xfrm/xfrm_state.c:1185 xfrm_tmpl_resolve_one net/xfrm/xfrm_policy.c:2393 [inline] xfrm_tmpl_resolve+0x2f3/0xd40 net/xfrm/xfrm_policy.c:2438 xfrm_resolve_and_create_bundle+0x123/0x2620 net/xfrm/xfrm_policy.c:2728 xfrm_lookup_with_ifid+0x22a/0x2240 net/xfrm/xfrm_policy.c:3062 xfrm_lookup net/xfrm/xfrm_policy.c:3191 [inline] xfrm_lookup_route+0x36/0x1e0 net/xfrm/xfrm_policy.c:3202 ip6_dst_lookup_flow+0x159/0x1d0 net/ipv6/ip6_output.c:1206 rawv6_sendmsg+0xc8c/0x3ab0 net/ipv6/raw.c:928 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:819 sock_sendmsg_nosec net/socket.c:705 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:725 ____sys_sendmsg+0x32b/0x800 net/socket.c:2413 ___sys_sendmsg+0xf3/0x170 net/socket.c:2467 __sys_sendmmsg+0x297/0x470 net/socket.c:2546 __compat_sys_sendmmsg net/compat.c:361 [inline] __do_compat_sys_sendmmsg net/compat.c:368 [inline] __se_compat_sys_sendmmsg net/compat.c:365 [inline] __ia32_compat_sys_sendmmsg+0x9b/0x100 net/compat.c:365 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c Second to last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 insert_work+0x48/0x350 kernel/workqueue.c:1358 __queue_work+0x62e/0x1140 kernel/workqueue.c:1517 queue_work_on+0xee/0x110 kernel/workqueue.c:1545 queue_work include/linux/workqueue.h:502 [inline] schedule_work include/linux/workqueue.h:563 [inline] xfrm_hash_grow_check net/xfrm/xfrm_state.c:1025 [inline] xfrm_hash_grow_check net/xfrm/xfrm_state.c:1020 [inline] xfrm_state_find+0x4af1/0x4f10 net/xfrm/xfrm_state.c:1185 xfrm_tmpl_resolve_one net/xfrm/xfrm_policy.c:2393 [inline] xfrm_tmpl_resolve+0x2f3/0xd40 net/xfrm/xfrm_policy.c:2438 xfrm_resolve_and_create_bundle+0x123/0x2620 net/xfrm/xfrm_policy.c:2728 xfrm_lookup_with_ifid+0x22a/0x2240 net/xfrm/xfrm_policy.c:3062 xfrm_lookup net/xfrm/xfrm_policy.c:3191 [inline] xfrm_lookup_route+0x36/0x1e0 net/xfrm/xfrm_policy.c:3202 ip6_dst_lookup_flow+0x159/0x1d0 net/ipv6/ip6_output.c:1206 rawv6_sendmsg+0xc8c/0x3ab0 net/ipv6/raw.c:928 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:819 sock_sendmsg_nosec net/socket.c:705 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:725 ____sys_sendmsg+0x32b/0x800 net/socket.c:2413 ___sys_sendmsg+0xf3/0x170 net/socket.c:2467 __sys_sendmmsg+0x297/0x470 net/socket.c:2546 __compat_sys_sendmmsg net/compat.c:361 [inline] __do_compat_sys_sendmmsg net/compat.c:368 [inline] __se_compat_sys_sendmmsg net/compat.c:365 [inline] __ia32_compat_sys_sendmmsg+0x9b/0x100 net/compat.c:365 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c The buggy address belongs to the object at ffff88801f3b0000 which belongs to the cache net_namespace of size 6784 The buggy address is located 1685 bytes inside of 6784-byte region [ffff88801f3b0000, ffff88801f3b1a80) The buggy address belongs to the physical page: page:ffffea00007cec00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88801f3b5280 pfn:0x1f3b0 head:ffffea00007cec00 order:3 compound_mapcount:0 compound_pincount:0 memcg:ffff88807c9b2081 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0001181e08 ffffea0001354e08 ffff888010dcd3c0 raw: ffff88801f3b5280 0000000000040001 00000001ffffffff ffff88807c9b2081 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3621, tgid 3621 (syz-executor.0), ts 52958833128, free_ts 52638766258 prep_new_page mm/page_alloc.c:2441 [inline] get_page_from_freelist+0xba2/0x3e00 mm/page_alloc.c:4182 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5408 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2272 alloc_slab_page mm/slub.c:1799 [inline] allocate_slab+0x26c/0x3c0 mm/slub.c:1944 new_slab mm/slub.c:2004 [inline] ___slab_alloc+0x8df/0xf20 mm/slub.c:3005 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3092 slab_alloc_node mm/slub.c:3183 [inline] slab_alloc mm/slub.c:3225 [inline] __kmem_cache_alloc_lru mm/slub.c:3232 [inline] kmem_cache_alloc+0x360/0x3b0 mm/slub.c:3242 kmem_cache_zalloc include/linux/slab.h:704 [inline] net_alloc net/core/net_namespace.c:403 [inline] copy_net_ns+0x125/0x760 net/core/net_namespace.c:458 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0xc1/0x1f0 kernel/nsproxy.c:226 ksys_unshare+0x445/0x920 kernel/fork.c:3132 __do_sys_unshare kernel/fork.c:3203 [inline] __se_sys_unshare kernel/fork.c:3201 [inline] __ia32_sys_unshare+0x2c/0x40 kernel/fork.c:3201 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1356 [inline] free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1406 free_unref_page_prepare mm/page_alloc.c:3328 [inline] free_unref_page+0x19/0x6a0 mm/page_alloc.c:3423 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2523 qlink_free mm/kasan/quarantine.c:157 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:446 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:749 [inline] slab_alloc_node mm/slub.c:3217 [inline] slab_alloc mm/slub.c:3225 [inline] __kmalloc+0x200/0x350 mm/slub.c:4410 kmalloc include/linux/slab.h:586 [inline] tomoyo_realpath_from_path+0xc3/0x620 security/tomoyo/realpath.c:254 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x21b/0x400 security/tomoyo/file.c:822 security_path_truncate+0xcf/0x140 security/security.c:1216 handle_truncate fs/namei.c:3130 [inline] do_open fs/namei.c:3480 [inline] path_openat+0x1d82/0x2910 fs/namei.c:3609 do_filp_open+0x1aa/0x400 fs/namei.c:3636 do_sys_openat2+0x16d/0x4c0 fs/open.c:1213 do_sys_open fs/open.c:1229 [inline] __do_sys_openat fs/open.c:1245 [inline] __se_sys_openat fs/open.c:1240 [inline] __x64_sys_openat+0x13f/0x1f0 fs/open.c:1240 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Memory state around the buggy address: ffff88801f3b0580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801f3b0600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88801f3b0680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88801f3b0700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801f3b0780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 74 24 je 0x26 2: 10 e8 adc %ch,%al 4: 2a f1 sub %cl,%dh 6: f0 f7 48 89 ef e8 72 lock testl $0x7072e8ef,-0x77(%rax) d: 70 e: f1 icebp f: f7 81 e3 00 02 00 00 testl $0x9c257500,0x200e3(%rcx) 16: 75 25 9c 19: 58 pop %rax 1a: f6 c4 02 test $0x2,%ah 1d: 75 2d jne 0x4c 1f: 48 85 db test %rbx,%rbx 22: 74 01 je 0x25 24: fb sti 25: bf 01 00 00 00 mov $0x1,%edi * 2a: e8 93 8f e4 f7 callq 0xf7e48fc2 <-- trapping instruction 2f: 65 8b 05 3c c4 95 76 mov %gs:0x7695c43c(%rip),%eax # 0x7695c472 36: 85 c0 test %eax,%eax 38: 74 0a je 0x44 3a: 5b pop %rbx 3b: 5d pop %rbp 3c: c3 retq 3d: e8 .byte 0xe8 3e: 70 cc jo 0xc