================================================================== 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 ffff88804a548745 by task syz-executor.0/5075 CPU: 0 PID: 5075 Comm: syz-executor.0 Not tainted 6.1.0-rc2-syzkaller-00105-gb229b6ca5abb #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/11/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:284 [inline] print_report+0x15e/0x45d mm/kasan/report.c:395 kasan_report+0xbb/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+0x998/0x9f0 net/ipv4/tcp_timer.c:594 tcp_write_timer+0xa2/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+0xb3/0x1d0 kernel/time/timer.c:1803 __do_softirq+0x1f7/0xad8 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:1107 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:649 RIP: 0010:__might_resched+0xe/0x2c0 kernel/sched/core.c:9845 Code: 2b 04 25 28 00 00 00 75 07 48 83 ec 80 5b 5d c3 e8 a7 a3 3b 08 0f 1f 80 00 00 00 00 41 56 41 55 41 54 41 89 f4 be ff ff ff ff <55> 48 89 fd 48 c7 c7 60 89 f8 8b 53 89 d3 e8 5f a7 3b 08 85 c0 0f RSP: 0018:ffffc9000b997870 EFLAGS: 00000246 RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 00000000ffffffff RDI: ffffffff89f912a0 RBP: 0000000000002000 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 000000000008c07e R12: 0000000000000644 R13: 0000000000000001 R14: 0000000000000040 R15: ffffe8ffffffffff alloc_vmap_area+0x14b/0x1d30 mm/vmalloc.c:1604 __get_vm_area_node+0x142/0x3f0 mm/vmalloc.c:2501 __vmalloc_node_range+0x250/0x13a0 mm/vmalloc.c:3173 __vmalloc_node mm/vmalloc.c:3278 [inline] vzalloc+0x67/0x80 mm/vmalloc.c:3351 do_ipt_get_ctl+0x60d/0x9d0 net/ipv4/netfilter/ip_tables.c:801 nf_getsockopt+0x72/0xd0 net/netfilter/nf_sockopt.c:116 ip_getsockopt+0x185/0x1e0 net/ipv4/ip_sockglue.c:1796 tcp_getsockopt+0x95/0xf0 net/ipv4/tcp.c:4402 __sys_getsockopt+0x216/0x690 net/socket.c:2296 __do_sys_getsockopt net/socket.c:2311 [inline] __se_sys_getsockopt net/socket.c:2308 [inline] __x64_sys_getsockopt+0xba/0x150 net/socket.c:2308 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 RIP: 0033:0x7f47dea8cbca Code: 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 37 00 00 00 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:00007ffeb091a158 EFLAGS: 00000216 ORIG_RAX: 0000000000000037 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f47dea8cbca RDX: 0000000000000041 RSI: 0000000000000000 RDI: 0000000000000003 RBP: 00007ffeb091a180 R08: 00007ffeb091a17c R09: ffffffffffffff00 R10: 00007ffeb091a1e0 R11: 0000000000000216 R12: 00007ffeb091a1e0 R13: 0000000000000003 R14: 00007ffeb091a17c R15: 00007f47deb84820 Allocated by task 1346: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 kasan_set_track+0x21/0x30 mm/kasan/common.c:52 __kasan_slab_alloc+0x7e/0x80 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/slub.c:3398 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x2ac/0x3c0 mm/slub.c:3422 kmem_cache_zalloc include/linux/slab.h:702 [inline] net_alloc net/core/net_namespace.c:410 [inline] copy_net_ns+0x125/0x760 net/core/net_namespace.c:465 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:3188 __do_sys_unshare kernel/fork.c:3259 [inline] __se_sys_unshare kernel/fork.c:3257 [inline] __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3257 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 29766: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 kasan_set_track+0x21/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2a/0x40 mm/kasan/generic.c:511 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1750 slab_free mm/slub.c:3661 [inline] kmem_cache_free+0xea/0x5b0 mm/slub.c:3683 net_free net/core/net_namespace.c:439 [inline] net_free net/core/net_namespace.c:435 [inline] cleanup_net+0x8ba/0xb00 net/core/net_namespace.c:622 process_one_work+0x9bf/0x1710 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 Last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 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+0x152/0x1d0 kernel/time/timer.c:1805 __do_softirq+0x1f7/0xad8 kernel/softirq.c:571 Second to last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 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+0x152/0x1d0 kernel/time/timer.c:1805 __do_softirq+0x1f7/0xad8 kernel/softirq.c:571 The buggy address belongs to the object at ffff88804a548000 which belongs to the cache net_namespace of size 6976 The buggy address is located 1861 bytes inside of 6976-byte region [ffff88804a548000, ffff88804a549b40) The buggy address belongs to the physical page: page:ffffea0001295200 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88804a54b880 pfn:0x4a548 head:ffffea0001295200 order:3 compound_mapcount:0 compound_pincount:0 memcg:ffff88801d665241 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0001b48000 dead000000000002 ffff8880119d6500 raw: ffff88804a54b880 0000000080040001 00000001ffffffff ffff88801d665241 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 15304, tgid 15297 (syz-executor.4), ts 539558935789, free_ts 539505380245 prep_new_page mm/page_alloc.c:2538 [inline] get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4287 __alloc_pages+0x1c7/0x5a0 mm/page_alloc.c:5554 alloc_pages+0x1a6/0x270 mm/mempolicy.c:2285 alloc_slab_page mm/slub.c:1794 [inline] allocate_slab+0x213/0x300 mm/slub.c:1939 new_slab mm/slub.c:1992 [inline] ___slab_alloc+0xa91/0x1400 mm/slub.c:3180 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3279 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+0x312/0x3c0 mm/slub.c:3422 kmem_cache_zalloc include/linux/slab.h:702 [inline] net_alloc net/core/net_namespace.c:410 [inline] copy_net_ns+0x125/0x760 net/core/net_namespace.c:465 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:3188 __do_sys_unshare kernel/fork.c:3259 [inline] __se_sys_unshare kernel/fork.c:3257 [inline] __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3257 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:1458 [inline] free_pcp_prepare+0x65c/0xd90 mm/page_alloc.c:1508 free_unref_page_prepare mm/page_alloc.c:3386 [inline] free_unref_page+0x19/0x4d0 mm/page_alloc.c:3482 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x62/0x80 mm/kasan/common.c:302 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slab.h:737 [inline] slab_alloc_node mm/slub.c:3398 [inline] __kmem_cache_alloc_node+0x2da/0x3e0 mm/slub.c:3437 __do_kmalloc_node mm/slab_common.c:954 [inline] __kmalloc+0x44/0xc0 mm/slab_common.c:968 kmalloc include/linux/slab.h:581 [inline] kzalloc include/linux/slab.h:712 [inline] tomoyo_encode2.part.0+0xe9/0x3a0 security/tomoyo/realpath.c:45 tomoyo_encode2 security/tomoyo/realpath.c:31 [inline] tomoyo_encode+0x28/0x50 security/tomoyo/realpath.c:80 tomoyo_path_perm+0x368/0x400 security/tomoyo/file.c:831 tomoyo_path_symlink+0x94/0xe0 security/tomoyo/tomoyo.c:199 security_path_symlink+0xdf/0x150 security/security.c:1184 do_symlinkat+0x106/0x2e0 fs/namei.c:4424 __do_sys_symlinkat fs/namei.c:4446 [inline] __se_sys_symlinkat fs/namei.c:4443 [inline] __x64_sys_symlinkat+0x93/0xc0 fs/namei.c:4443 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 Memory state around the buggy address: ffff88804a548600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88804a548680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88804a548700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88804a548780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88804a548800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 2b 04 25 28 00 00 00 sub 0x28,%eax 7: 75 07 jne 0x10 9: 48 83 ec 80 sub $0xffffffffffffff80,%rsp d: 5b pop %rbx e: 5d pop %rbp f: c3 retq 10: e8 a7 a3 3b 08 callq 0x83ba3bc 15: 0f 1f 80 00 00 00 00 nopl 0x0(%rax) 1c: 41 56 push %r14 1e: 41 55 push %r13 20: 41 54 push %r12 22: 41 89 f4 mov %esi,%r12d 25: be ff ff ff ff mov $0xffffffff,%esi * 2a: 55 push %rbp <-- trapping instruction 2b: 48 89 fd mov %rdi,%rbp 2e: 48 c7 c7 60 89 f8 8b mov $0xffffffff8bf88960,%rdi 35: 53 push %rbx 36: 89 d3 mov %edx,%ebx 38: e8 5f a7 3b 08 callq 0x83ba79c 3d: 85 c0 test %eax,%eax 3f: 0f .byte 0xf