================================================================== 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+0x998/0x9f0 net/ipv4/tcp_timer.c:594 Read of size 1 at addr ffff88801d250825 by task syz-fuzzer/3626 CPU: 0 PID: 3626 Comm: syz-fuzzer Not tainted 6.0.0-syzkaller-00372-ga5088ee7251e #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:317 [inline] print_report.cold+0x2ba/0x6e9 mm/kasan/report.c:433 kasan_report+0xb1/0x1e0 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+0x998/0x9f0 net/ipv4/tcp_timer.c:594 tcp_write_timer+0xa2/0x2b0 net/ipv4/tcp_timer.c:637 call_timer_fn+0x1a0/0x6b0 kernel/time/timer.c:1474 expire_timers kernel/time/timer.c:1519 [inline] __run_timers.part.0+0x674/0xa80 kernel/time/timer.c:1790 __run_timers kernel/time/timer.c:1768 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1803 __do_softirq+0x1d3/0x9c6 kernel/softirq.c:571 invoke_softirq kernel/softirq.c:445 [inline] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:650 irq_exit_rcu+0x5/0x20 kernel/softirq.c:662 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1106 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:649 RIP: 0010:write_comp_data+0x3c/0x90 kernel/kcov.c:229 Code: 01 00 00 49 89 f8 65 48 8b 14 25 80 6f 02 00 a9 00 01 ff 00 74 0e 85 f6 74 59 8b 82 bc 15 00 00 85 c0 74 4f 8b 82 98 15 00 00 <83> f8 03 75 44 48 8b 82 a0 15 00 00 8b 92 9c 15 00 00 48 8b 38 48 RSP: 0000:ffffc900030b7eb0 EFLAGS: 00000246 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff81367270 RDX: ffff88807bc72180 RSI: 0000000000000000 RDI: 0000000000000007 RBP: 0000000000000004 R08: 0000000000000007 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: ffffc900030b7f58 R13: 000000c01131af08 R14: ffff888076c12250 R15: ffff88801af96840 __pkru_allows_pkey arch/x86/include/asm/pgtable.h:1384 [inline] arch_vma_access_permitted arch/x86/include/asm/mmu_context.h:216 [inline] arch_vma_access_permitted arch/x86/include/asm/mmu_context.h:207 [inline] access_error arch/x86/mm/fault.c:1106 [inline] do_user_addr_fault+0xc20/0x1210 arch/x86/mm/fault.c:1379 handle_page_fault arch/x86/mm/fault.c:1488 [inline] exc_page_fault+0x94/0x170 arch/x86/mm/fault.c:1544 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570 RIP: 0033:0x41e5db Code: 0f b6 11 44 89 c1 45 89 d5 41 d3 ea 41 0f ba e2 04 0f 83 ec 00 00 00 48 89 44 24 58 41 0f a3 cd 0f 83 87 00 00 00 4e 8d 14 20 <4d> 8b 12 66 90 4d 85 d2 74 79 4d 89 d5 4d 29 e2 4c 39 d2 77 6e 89 RSP: 002b:000000c0005cfe80 EFLAGS: 00010203 RAX: 0000000000000008 RBX: 000000c000041698 RCX: 0000000000000001 RDX: 0000000000000030 RSI: 0000000000203004 RDI: 0000000000c04620 RBP: 000000c0005cff08 R08: 0000000000000001 R09: 00007f3cd3f11d78 R10: 000000c01131af08 R11: 00007f3cd4078fff R12: 000000c01131af00 R13: 00000000000000f2 R14: 000000c00776a4e0 R15: 0000000001142f60 Allocated by task 3635: 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:437 [inline] __kasan_slab_alloc+0x85/0xb0 mm/kasan/common.c:470 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:727 [inline] slab_alloc mm/slab.c:3294 [inline] __kmem_cache_alloc_lru mm/slab.c:3471 [inline] kmem_cache_alloc+0x214/0x520 mm/slab.c:3491 kmem_cache_zalloc include/linux/slab.h:723 [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:3181 __do_sys_unshare kernel/fork.c:3252 [inline] __se_sys_unshare kernel/fork.c:3250 [inline] __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3250 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+0x63/0xcd Freed by task 3853: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:367 [inline] ____kasan_slab_free+0x13d/0x1a0 mm/kasan/common.c:329 kasan_slab_free include/linux/kasan.h:200 [inline] __cache_free mm/slab.c:3418 [inline] kmem_cache_free.part.0+0x10f/0x2e0 mm/slab.c:3725 net_free net/core/net_namespace.c:432 [inline] net_free net/core/net_namespace.c:428 [inline] cleanup_net+0x8ba/0xb00 net/core/net_namespace.c:615 process_one_work+0x991/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e4/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 The buggy address belongs to the object at ffff88801d250180 which belongs to the cache net_namespace of size 6784 The buggy address is located 1701 bytes inside of 6784-byte region [ffff88801d250180, ffff88801d251c00) The buggy address belongs to the physical page: page:ffffea0000749400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1d250 head:ffffea0000749400 order:1 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0000ce6508 ffffea00007c0908 ffff88801201d500 raw: 0000000000000000 ffff88801d250180 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 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 3635, tgid 3635 (syz-executor.3), ts 174495189013, free_ts 83628045809 prep_new_page mm/page_alloc.c:2532 [inline] get_page_from_freelist+0x109b/0x2ce0 mm/page_alloc.c:4283 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5549 __alloc_pages_node include/linux/gfp.h:243 [inline] kmem_getpages mm/slab.c:1363 [inline] cache_grow_begin+0x75/0x360 mm/slab.c:2569 cache_alloc_refill+0x27f/0x380 mm/slab.c:2942 ____cache_alloc mm/slab.c:3018 [inline] ____cache_alloc mm/slab.c:3001 [inline] __do_cache_alloc mm/slab.c:3246 [inline] slab_alloc mm/slab.c:3287 [inline] __kmem_cache_alloc_lru mm/slab.c:3471 [inline] kmem_cache_alloc+0x433/0x520 mm/slab.c:3491 kmem_cache_zalloc include/linux/slab.h:723 [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:3181 __do_sys_unshare kernel/fork.c:3252 [inline] __se_sys_unshare kernel/fork.c:3250 [inline] __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3250 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+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1449 [inline] free_pcp_prepare+0x5e4/0xd20 mm/page_alloc.c:1499 free_unref_page_prepare mm/page_alloc.c:3380 [inline] free_unref_page+0x19/0x4d0 mm/page_alloc.c:3476 slab_destroy mm/slab.c:1615 [inline] slabs_destroy+0x89/0xc0 mm/slab.c:1635 cache_flusharray mm/slab.c:3389 [inline] ___cache_free+0x2a8/0x3d0 mm/slab.c:3452 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x4f/0x1b0 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x97/0xb0 mm/kasan/common.c:447 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:727 [inline] slab_alloc_node mm/slab.c:3232 [inline] kmem_cache_alloc_node+0x2f1/0x560 mm/slab.c:3583 __alloc_skb+0x210/0x2f0 net/core/skbuff.c:422 alloc_skb_fclone include/linux/skbuff.h:1307 [inline] tcp_stream_alloc_skb+0x38/0x580 net/ipv4/tcp.c:861 tcp_sendmsg_locked+0xc36/0x2f80 net/ipv4/tcp.c:1325 tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1483 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:819 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:734 sock_write_iter+0x291/0x3d0 net/socket.c:1108 call_write_iter include/linux/fs.h:2187 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x9e9/0xdd0 fs/read_write.c:584 Memory state around the buggy address: ffff88801d250700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801d250780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88801d250800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88801d250880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801d250900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 01 00 add %eax,(%rax) 2: 00 49 89 add %cl,-0x77(%rcx) 5: f8 clc 6: 65 48 8b 14 25 80 6f mov %gs:0x26f80,%rdx d: 02 00 f: a9 00 01 ff 00 test $0xff0100,%eax 14: 74 0e je 0x24 16: 85 f6 test %esi,%esi 18: 74 59 je 0x73 1a: 8b 82 bc 15 00 00 mov 0x15bc(%rdx),%eax 20: 85 c0 test %eax,%eax 22: 74 4f je 0x73 24: 8b 82 98 15 00 00 mov 0x1598(%rdx),%eax * 2a: 83 f8 03 cmp $0x3,%eax <-- trapping instruction 2d: 75 44 jne 0x73 2f: 48 8b 82 a0 15 00 00 mov 0x15a0(%rdx),%rax 36: 8b 92 9c 15 00 00 mov 0x159c(%rdx),%edx 3c: 48 8b 38 mov (%rax),%rdi 3f: 48 rex.W