================================================================== BUG: KASAN: use-after-free in tcp_probe_timer net/ipv4/tcp_timer.c:388 [inline] BUG: KASAN: use-after-free in tcp_write_timer_handler+0x7ef/0x930 net/ipv4/tcp_timer.c:652 Read of size 1 at addr ffff8881621e8745 by task kworker/u4:4/56 CPU: 0 PID: 56 Comm: kworker/u4:4 Not tainted 6.1.82-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024 Workqueue: events_unbound flush_to_ldisc Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x15f/0x4f0 mm/kasan/report.c:395 kasan_report+0x136/0x160 mm/kasan/report.c:495 tcp_probe_timer net/ipv4/tcp_timer.c:388 [inline] tcp_write_timer_handler+0x7ef/0x930 net/ipv4/tcp_timer.c:652 tcp_write_timer+0x12e/0x280 net/ipv4/tcp_timer.c:665 call_timer_fn+0x1ad/0x6b0 kernel/time/timer.c:1474 expire_timers kernel/time/timer.c:1519 [inline] __run_timers+0x67c/0x890 kernel/time/timer.c:1790 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1803 __do_softirq+0x2e9/0xa4c kernel/softirq.c:571 invoke_softirq kernel/softirq.c:445 [inline] __irq_exit_rcu+0x155/0x240 kernel/softirq.c:650 irq_exit_rcu+0x5/0x20 kernel/softirq.c:662 sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1106 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:653 RIP: 0010:arch_test_and_set_bit arch/x86/include/asm/bitops.h:138 [inline] RIP: 0010:test_and_set_bit include/asm-generic/bitops/instrumented-atomic.h:72 [inline] RIP: 0010:queue_work_on+0x1f4/0x250 kernel/workqueue.c:1547 Code: 11 e8 20 32 31 00 4d 85 e4 75 16 e8 16 32 31 00 eb 15 e8 0f 32 31 00 e8 aa 36 30 09 4d 85 e4 74 ea e8 00 32 31 00 fb 45 84 ed <0f> 94 c0 48 c7 44 24 20 0e 36 e0 45 48 b9 00 00 00 00 00 fc ff df RSP: 0018:ffffc900015777c0 EFLAGS: 00000246 RAX: ffffffff81595190 RBX: 0000000000000000 RCX: ffff88801a6b5940 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc90001577888 R08: ffffffff81595166 R09: fffffbfff2092c59 R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000200 R13: 0000000000000000 R14: 0000000000000046 R15: 1ffff920002aeefc queue_work include/linux/workqueue.h:512 [inline] tty_insert_flip_string_and_push_buffer+0x329/0x390 drivers/tty/tty_buffer.c:634 tty_put_char+0x116/0x180 drivers/tty/tty_io.c:3141 __process_echoes+0x462/0x920 drivers/tty/n_tty.c:716 flush_echoes drivers/tty/n_tty.c:817 [inline] __receive_buf drivers/tty/n_tty.c:1615 [inline] n_tty_receive_buf_common+0xd1c/0x1410 drivers/tty/n_tty.c:1711 tty_port_default_receive_buf+0x6a/0x90 drivers/tty/tty_port.c:39 receive_buf drivers/tty/tty_buffer.c:515 [inline] flush_to_ldisc+0x2f4/0x840 drivers/tty/tty_buffer.c:565 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439 kthread+0x28d/0x320 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:307 Allocated by task 3579: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 __kasan_slab_alloc+0x65/0x70 mm/kasan/common.c:328 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook+0x52/0x3a0 mm/slab.h:737 slab_alloc_node mm/slub.c:3398 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x10c/0x2d0 mm/slub.c:3422 kmem_cache_zalloc include/linux/slab.h:682 [inline] net_alloc net/core/net_namespace.c:410 [inline] copy_net_ns+0x143/0x5d0 net/core/net_namespace.c:465 create_new_namespaces+0x425/0x7a0 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0x11e/0x170 kernel/nsproxy.c:226 ksys_unshare+0x580/0xb20 kernel/fork.c:3203 __do_sys_unshare kernel/fork.c:3274 [inline] __se_sys_unshare kernel/fork.c:3272 [inline] __x64_sys_unshare+0x34/0x40 kernel/fork.c:3272 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:486 insert_work+0x54/0x3d0 kernel/workqueue.c:1361 __queue_work+0xb4b/0xf90 kernel/workqueue.c:1520 call_timer_fn+0x1ad/0x6b0 kernel/time/timer.c:1474 expire_timers kernel/time/timer.c:1514 [inline] __run_timers+0x6a8/0x890 kernel/time/timer.c:1790 __do_softirq+0x2e9/0xa4c kernel/softirq.c:571 Second to last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:486 insert_work+0x54/0x3d0 kernel/workqueue.c:1361 __queue_work+0xb4b/0xf90 kernel/workqueue.c:1520 queue_work_on+0x14b/0x250 kernel/workqueue.c:1548 queue_work include/linux/workqueue.h:512 [inline] schedule_work include/linux/workqueue.h:573 [inline] xfrm_hash_grow_check net/xfrm/xfrm_state.c:1025 [inline] __find_acq_core+0x1073/0x1470 net/xfrm/xfrm_state.c:1418 xfrm_find_acq+0x68/0x90 net/xfrm/xfrm_state.c:1844 xfrm_alloc_userspi+0x634/0xc90 net/xfrm/xfrm_user.c:1582 xfrm_user_rcv_msg+0x6f0/0xa40 net/xfrm/xfrm_user.c:3105 netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2508 xfrm_netlink_rcv+0x70/0x80 net/xfrm/xfrm_user.c:3127 netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline] netlink_unicast+0x7d8/0x970 net/netlink/af_netlink.c:1352 netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1874 sock_sendmsg_nosec net/socket.c:718 [inline] __sock_sendmsg net/socket.c:730 [inline] ____sys_sendmsg+0x5a5/0x8f0 net/socket.c:2514 ___sys_sendmsg net/socket.c:2568 [inline] __sys_sendmsg+0x2a9/0x390 net/socket.c:2597 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff8881621e8000 which belongs to the cache net_namespace of size 6976 The buggy address is located 1861 bytes inside of 6976-byte region [ffff8881621e8000, ffff8881621e9b40) The buggy address belongs to the physical page: page:ffffea0005887a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8881621e8000 pfn:0x1621e8 head:ffffea0005887a00 order:3 compound_mapcount:0 compound_pincount:0 memcg:ffff88814b2a4781 flags: 0x57ff00000010200(slab|head|node=1|zone=2|lastcpupid=0x7ff) raw: 057ff00000010200 0000000000000000 dead000000000001 ffff888140009500 raw: ffff8881621e8000 0000000080040000 00000001ffffffff ffff88814b2a4781 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 3579, tgid 3579 (syz-executor.1), ts 184140056364, free_ts 0 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2513 prep_new_page mm/page_alloc.c:2520 [inline] get_page_from_freelist+0x31a1/0x3320 mm/page_alloc.c:4279 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5545 alloc_slab_page+0x6a/0x150 mm/slub.c:1794 allocate_slab mm/slub.c:1939 [inline] new_slab+0x84/0x2d0 mm/slub.c:1992 ___slab_alloc+0xc20/0x1270 mm/slub.c:3180 __slab_alloc mm/slub.c:3279 [inline] slab_alloc_node mm/slub.c:3364 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x1a5/0x2d0 mm/slub.c:3422 kmem_cache_zalloc include/linux/slab.h:682 [inline] net_alloc net/core/net_namespace.c:410 [inline] copy_net_ns+0x143/0x5d0 net/core/net_namespace.c:465 create_new_namespaces+0x425/0x7a0 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0x11e/0x170 kernel/nsproxy.c:226 ksys_unshare+0x580/0xb20 kernel/fork.c:3203 __do_sys_unshare kernel/fork.c:3274 [inline] __se_sys_unshare kernel/fork.c:3272 [inline] __x64_sys_unshare+0x34/0x40 kernel/fork.c:3272 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x63/0xcd page_owner free stack trace missing Memory state around the buggy address: ffff8881621e8600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881621e8680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881621e8700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881621e8780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881621e8800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 11 e8 adc %ebp,%eax 2: 20 32 and %dh,(%rdx) 4: 31 00 xor %eax,(%rax) 6: 4d 85 e4 test %r12,%r12 9: 75 16 jne 0x21 b: e8 16 32 31 00 call 0x313226 10: eb 15 jmp 0x27 12: e8 0f 32 31 00 call 0x313226 17: e8 aa 36 30 09 call 0x93036c6 1c: 4d 85 e4 test %r12,%r12 1f: 74 ea je 0xb 21: e8 00 32 31 00 call 0x313226 26: fb sti 27: 45 84 ed test %r13b,%r13b * 2a: 0f 94 c0 sete %al <-- trapping instruction 2d: 48 c7 44 24 20 0e 36 movq $0x45e0360e,0x20(%rsp) 34: e0 45 36: 48 b9 00 00 00 00 00 movabs $0xdffffc0000000000,%rcx 3d: fc ff df