================================================================== BUG: KASAN: use-after-free in tcp_probe_timer net/ipv4/tcp_timer.c:378 [inline] BUG: KASAN: use-after-free in tcp_write_timer_handler net/ipv4/tcp_timer.c:624 [inline] BUG: KASAN: use-after-free in tcp_write_timer_handler+0x99c/0x9f0 net/ipv4/tcp_timer.c:594 Read of size 1 at addr ffff88806c3de785 by task syz-executor.2/14908 CPU: 1 PID: 14908 Comm: syz-executor.2 Not tainted 6.1.0-rc7-syzkaller-00200-gc2bf05db6c78 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x15e/0x461 mm/kasan/report.c:395 kasan_report+0xbf/0x1f0 mm/kasan/report.c:495 tcp_probe_timer net/ipv4/tcp_timer.c:378 [inline] tcp_write_timer_handler net/ipv4/tcp_timer.c:624 [inline] tcp_write_timer_handler+0x99c/0x9f0 net/ipv4/tcp_timer.c:594 tcp_write_timer+0xa6/0x2b0 net/ipv4/tcp_timer.c:637 call_timer_fn+0x1da/0x7c0 kernel/time/timer.c:1474 expire_timers kernel/time/timer.c:1519 [inline] __run_timers.part.0+0x6a2/0xaf0 kernel/time/timer.c:1790 __run_timers kernel/time/timer.c:1768 [inline] run_timer_softirq+0xb7/0x1d0 kernel/time/timer.c:1803 __do_softirq+0x1fb/0xadc kernel/softirq.c:571 invoke_softirq kernel/softirq.c:445 [inline] __irq_exit_rcu+0x123/0x180 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:1107 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:649 RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x3c/0x70 kernel/locking/spinlock.c:194 Code: 74 24 10 e8 76 da 71 f7 48 89 ef e8 1e 47 72 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 4f d0 64 f7 65 8b 05 48 32 12 76 85 c0 74 0a 5b 5d c3 e8 3c 76 RSP: 0018:ffffc90003147778 EFLAGS: 00000206 RAX: 0000000000000002 RBX: 0000000000000200 RCX: 1ffffffff22260be RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001 RBP: ffff8880429de9d0 R08: 0000000000000001 R09: ffffffff910ecaf7 R10: 0000000000000001 R11: 0000000000000000 R12: ffff8880429de9b8 R13: ffffc90003147900 R14: ffff8880275f3540 R15: 0000000000000246 spin_unlock_irqrestore include/linux/spinlock.h:405 [inline] __skb_try_recv_datagram+0x16c/0x4f0 net/core/datagram.c:265 __unix_dgram_recvmsg+0x194/0xb90 net/unix/af_unix.c:2438 unix_dgram_recvmsg+0xc4/0xf0 net/unix/af_unix.c:2535 sock_recvmsg_nosec net/socket.c:995 [inline] ____sys_recvmsg+0x53c/0x610 net/socket.c:2699 ___sys_recvmsg+0xf2/0x180 net/socket.c:2743 do_recvmmsg+0x25e/0x6e0 net/socket.c:2837 __sys_recvmmsg net/socket.c:2916 [inline] __do_sys_recvmmsg net/socket.c:2939 [inline] __se_sys_recvmmsg net/socket.c:2932 [inline] __x64_sys_recvmmsg+0x20f/0x260 net/socket.c:2932 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:0x7f4daac8c0d9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f4da9fde168 EFLAGS: 00000246 ORIG_RAX: 000000000000012b RAX: ffffffffffffffda RBX: 00007f4daadac050 RCX: 00007f4daac8c0d9 RDX: 0000000000010106 RSI: 00000000200000c0 RDI: 0000000000000003 RBP: 00007f4daace7ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffef73d097f R14: 00007f4da9fde300 R15: 0000000000022000 Allocated by task 3743: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 __kasan_slab_alloc+0x7f/0x90 mm/kasan/common.c:325 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slab.h:737 [inline] slab_alloc_node mm/slab.c:3257 [inline] slab_alloc mm/slab.c:3265 [inline] __kmem_cache_alloc_lru mm/slab.c:3442 [inline] kmem_cache_alloc+0x220/0x460 mm/slab.c:3461 kmem_cache_zalloc include/linux/slab.h:679 [inline] net_alloc net/core/net_namespace.c:410 [inline] copy_net_ns+0x129/0x760 net/core/net_namespace.c:465 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0xc5/0x1f0 kernel/nsproxy.c:226 ksys_unshare+0x449/0x920 kernel/fork.c:3188 __do_sys_unshare kernel/fork.c:3259 [inline] __se_sys_unshare kernel/fork.c:3257 [inline] __x64_sys_unshare+0x31/0x40 kernel/fork.c:3257 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 7811: 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:511 ____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:177 [inline] __cache_free mm/slab.c:3389 [inline] __do_kmem_cache_free mm/slab.c:3585 [inline] kmem_cache_free mm/slab.c:3610 [inline] kmem_cache_free+0x108/0x4c0 mm/slab.c:3603 net_free net/core/net_namespace.c:439 [inline] net_free net/core/net_namespace.c:435 [inline] cleanup_net+0x8be/0xb00 net/core/net_namespace.c:622 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x669/0x1090 kernel/workqueue.c:2436 kthread+0x2e8/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 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:481 insert_work+0x48/0x350 kernel/workqueue.c:1358 __queue_work+0x693/0x13b0 kernel/workqueue.c:1517 queue_work_on+0xf2/0x110 kernel/workqueue.c:1545 queue_work include/linux/workqueue.h:503 [inline] schedule_work include/linux/workqueue.h:564 [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_insert+0x1228/0x17b0 net/xfrm/xfrm_state.c:1307 xfrm_state_add+0x5cf/0xe30 net/xfrm/xfrm_state.c:1464 xfrm_add_sa+0x2ce1/0x4290 net/xfrm/xfrm_user.c:788 xfrm_user_rcv_msg+0x44a/0xa40 net/xfrm/xfrm_user.c:3054 netlink_rcv_skb+0x157/0x430 net/netlink/af_netlink.c:2540 xfrm_netlink_rcv+0x6f/0x90 net/xfrm/xfrm_user.c:3076 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1921 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xd3/0x120 net/socket.c:734 ____sys_sendmsg+0x712/0x8c0 net/socket.c:2482 ___sys_sendmsg+0x110/0x1b0 net/socket.c:2536 __sys_sendmsg+0xf7/0x1c0 net/socket.c:2565 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 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:481 insert_work+0x48/0x350 kernel/workqueue.c:1358 __queue_work+0x693/0x13b0 kernel/workqueue.c:1517 call_timer_fn+0x1da/0x7c0 kernel/time/timer.c:1474 expire_timers kernel/time/timer.c:1514 [inline] __run_timers.part.0+0x4a3/0xaf0 kernel/time/timer.c:1790 __run_timers kernel/time/timer.c:1768 [inline] run_timer_softirq+0x156/0x1d0 kernel/time/timer.c:1805 __do_softirq+0x1fb/0xadc kernel/softirq.c:571 The buggy address belongs to the object at ffff88806c3de040 which belongs to the cache net_namespace of size 6976 The buggy address is located 1861 bytes inside of 6976-byte region [ffff88806c3de040, ffff88806c3dfb80) The buggy address belongs to the physical page: page:ffffea0001b0f780 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x6c3de head:ffffea0001b0f780 order:1 compound_mapcount:0 compound_pincount:0 flags: 0x4fff00000010200(slab|head|node=1|zone=1|lastcpupid=0x7ff) raw: 04fff00000010200 ffff8880400aff50 ffffea0001b1f308 ffff8880129a5700 raw: 0000000000000000 ffff88806c3de040 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0x40cc0(GFP_KERNEL|__GFP_COMP), pid 3743, tgid 3743 (syz-executor.2), ts 194288335717, free_ts 0 prep_new_page mm/page_alloc.c:2539 [inline] get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4291 __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5558 __alloc_pages_node include/linux/gfp.h:237 [inline] kmem_getpages mm/slab.c:1363 [inline] cache_grow_begin+0x94/0x390 mm/slab.c:2570 fallback_alloc+0x1e2/0x2d0 mm/slab.c:3113 __do_cache_alloc mm/slab.c:3217 [inline] slab_alloc_node mm/slab.c:3250 [inline] slab_alloc mm/slab.c:3265 [inline] __kmem_cache_alloc_lru mm/slab.c:3442 [inline] kmem_cache_alloc+0x300/0x460 mm/slab.c:3461 kmem_cache_zalloc include/linux/slab.h:679 [inline] net_alloc net/core/net_namespace.c:410 [inline] copy_net_ns+0x129/0x760 net/core/net_namespace.c:465 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0xc5/0x1f0 kernel/nsproxy.c:226 ksys_unshare+0x449/0x920 kernel/fork.c:3188 __do_sys_unshare kernel/fork.c:3259 [inline] __se_sys_unshare kernel/fork.c:3257 [inline] __x64_sys_unshare+0x31/0x40 kernel/fork.c:3257 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 page_owner free stack trace missing Memory state around the buggy address: ffff88806c3de680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806c3de700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88806c3de780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88806c3de800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806c3de880: 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: 76 da jbe 0xffffffe0 6: 71 f7 jno 0xffffffff 8: 48 89 ef mov %rbp,%rdi b: e8 1e 47 72 f7 callq 0xf772472e 10: 81 e3 00 02 00 00 and $0x200,%ebx 16: 75 25 jne 0x3d 18: 9c pushfq 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 4f d0 64 f7 callq 0xf764d07e <-- trapping instruction 2f: 65 8b 05 48 32 12 76 mov %gs:0x76123248(%rip),%eax # 0x7612327e 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: 3c 76 cmp $0x76,%al