================================================================== BUG: KASAN: use-after-free in inet_twsk_kill+0x358/0x3c0 net/ipv4/inet_timewait_sock.c:46 Read of size 8 at addr ffff88807c8b84c0 by task syz-executor.2/7286 CPU: 0 PID: 7286 Comm: syz-executor.2 Not tainted 5.16.0-syzkaller #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+0x8d/0x336 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 inet_twsk_kill+0x358/0x3c0 net/ipv4/inet_timewait_sock.c:46 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421 expire_timers kernel/time/timer.c:1466 [inline] __run_timers.part.0+0x67c/0xa30 kernel/time/timer.c:1734 __run_timers kernel/time/timer.c:1715 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1747 __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:638 RIP: 0010:preempt_latency_start kernel/sched/core.c:5430 [inline] RIP: 0010:preempt_latency_start kernel/sched/core.c:5425 [inline] RIP: 0010:preempt_count_add+0x81/0x140 kernel/sched/core.c:5453 Code: e5 ef b1 7e 25 ff ff ff 7f 39 c3 74 03 5b 5d c3 48 8b 5c 24 10 48 89 df e8 5c 08 0d 00 85 c0 75 35 65 48 8b 2c 25 00 70 02 00 <48> 8d bd 58 14 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 RSP: 0018:ffffc9000492f3b8 EFLAGS: 00000246 RAX: 0000000000000000 RBX: ffffffff81345b10 RCX: 1ffffffff20a3d38 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff81345b10 RBP: ffff888021d01d00 R08: ffffffff8e1c85be R09: 0000000000000001 R10: fffff52000925ea0 R11: 0000000000088078 R12: ffffc9000492f4f0 R13: 0000000000000000 R14: ffffc9000492f4a8 R15: 000000331e8abe9b unwind_next_frame+0x120/0x1ce0 arch/x86/kernel/unwind_orc.c:428 arch_stack_walk+0x7d/0xe0 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x8c/0xc0 kernel/stacktrace.c:122 save_stack+0x151/0x1e0 mm/page_owner.c:119 __reset_page_owner+0x5d/0x180 mm/page_owner.c:140 reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1352 [inline] free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1404 free_unref_page_prepare mm/page_alloc.c:3325 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3404 sctp_stream_free+0x128/0x180 net/sctp/stream.c:193 sctp_association_free+0x23b/0x7d0 net/sctp/associola.c:353 sctp_cmd_delete_tcb net/sctp/sm_sideeffect.c:940 [inline] sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1324 [inline] sctp_side_effects net/sctp/sm_sideeffect.c:1195 [inline] sctp_do_sm+0x365d/0x4ed0 net/sctp/sm_sideeffect.c:1166 sctp_assoc_bh_rcv+0x386/0x6c0 net/sctp/associola.c:1054 sctp_inq_push+0x1d2/0x270 net/sctp/inqueue.c:80 sctp_backlog_rcv+0x196/0x5a0 net/sctp/input.c:344 sk_backlog_rcv include/net/sock.h:1037 [inline] __release_sock+0x134/0x3b0 net/core/sock.c:2780 release_sock+0x54/0x1b0 net/core/sock.c:3312 sctp_close+0x447/0x940 net/sctp/socket.c:1533 inet_release+0x12e/0x280 net/ipv4/af_inet.c:428 inet6_release+0x4c/0x70 net/ipv6/af_inet6.c:478 __sock_release+0xcd/0x280 net/socket.c:650 sock_close+0x18/0x20 net/socket.c:1318 __fput+0x286/0x9f0 fs/file_table.c:280 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop kernel/entry/common.c:175 [inline] exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f974cbf5c9b Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44 RSP: 002b:00007fff39cf1a50 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000004 RCX: 00007f974cbf5c9b RDX: 0000000000000000 RSI: 0000001b2e227ee4 RDI: 0000000000000003 RBP: 00007f974cd57960 R08: 0000000000000000 R09: 0000000071df8e53 R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000035b01 R13: 00007fff39cf1b50 R14: 00007fff39cf1b70 R15: 0000000000000032 Allocated by task 6417: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:437 [inline] __kasan_slab_alloc+0x90/0xc0 mm/kasan/common.c:470 kasan_slab_alloc include/linux/kasan.h:260 [inline] slab_post_alloc_hook mm/slab.h:732 [inline] slab_alloc_node mm/slub.c:3230 [inline] slab_alloc mm/slub.c:3238 [inline] kmem_cache_alloc+0x202/0x3a0 mm/slub.c:3243 kmem_cache_zalloc include/linux/slab.h:705 [inline] net_alloc net/core/net_namespace.c:407 [inline] copy_net_ns+0x125/0x760 net/core/net_namespace.c:462 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:3048 __do_sys_unshare kernel/fork.c:3119 [inline] __se_sys_unshare kernel/fork.c:3117 [inline] __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3117 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 The buggy address belongs to the object at ffff88807c8b8000 which belongs to the cache net_namespace of size 6528 The buggy address is located 1216 bytes inside of 6528-byte region [ffff88807c8b8000, ffff88807c8b9980) The buggy address belongs to the page: page:ffffea0001f22e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88807c8bcf80 pfn:0x7c8b8 head:ffffea0001f22e00 order:3 compound_mapcount:0 compound_pincount:0 memcg:ffff88807f7b6dc1 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffff888010dd4f48 ffffea00012ce008 ffff888144384000 raw: ffff88807c8bcf80 0000000000040000 00000001ffffffff ffff88807f7b6dc1 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 3630, ts 121099818325, free_ts 121087271380 prep_new_page mm/page_alloc.c:2434 [inline] get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4165 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5389 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2271 alloc_slab_page mm/slub.c:1799 [inline] allocate_slab mm/slub.c:1944 [inline] new_slab+0x28a/0x3b0 mm/slub.c:2004 ___slab_alloc+0x87c/0xe90 mm/slub.c:3018 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3105 slab_alloc_node mm/slub.c:3196 [inline] slab_alloc mm/slub.c:3238 [inline] kmem_cache_alloc+0x35c/0x3a0 mm/slub.c:3243 kmem_cache_zalloc include/linux/slab.h:705 [inline] net_alloc net/core/net_namespace.c:407 [inline] copy_net_ns+0x125/0x760 net/core/net_namespace.c:462 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:3048 __do_sys_unshare kernel/fork.c:3119 [inline] __se_sys_unshare kernel/fork.c:3117 [inline] __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3117 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 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1352 [inline] free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1404 free_unref_page_prepare mm/page_alloc.c:3325 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3404 __unfreeze_partials+0x320/0x340 mm/slub.c:2536 qlink_free mm/kasan/quarantine.c:157 [inline] qlist_free_all+0x6d/0x160 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:447 kasan_slab_alloc include/linux/kasan.h:260 [inline] slab_post_alloc_hook mm/slab.h:732 [inline] slab_alloc_node mm/slub.c:3230 [inline] slab_alloc mm/slub.c:3238 [inline] kmem_cache_alloc_trace+0x1e9/0x2c0 mm/slub.c:3255 kmalloc include/linux/slab.h:581 [inline] tomoyo_print_header security/tomoyo/audit.c:156 [inline] tomoyo_init_log+0x18a/0x1ee0 security/tomoyo/audit.c:255 tomoyo_supervisor+0x34d/0xf00 security/tomoyo/common.c:2097 tomoyo_audit_path_log security/tomoyo/file.c:168 [inline] tomoyo_path_permission security/tomoyo/file.c:587 [inline] tomoyo_path_permission+0x270/0x3a0 security/tomoyo/file.c:573 tomoyo_check_open_permission+0x30f/0x380 security/tomoyo/file.c:780 tomoyo_file_open security/tomoyo/tomoyo.c:311 [inline] tomoyo_file_open+0xa3/0xd0 security/tomoyo/tomoyo.c:306 security_file_open+0x45/0xb0 security/security.c:1627 do_dentry_open+0x358/0x1240 fs/open.c:811 do_open fs/namei.c:3426 [inline] path_openat+0x1c9e/0x2940 fs/namei.c:3559 do_filp_open+0x1aa/0x400 fs/namei.c:3586 Memory state around the buggy address: ffff88807c8b8380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807c8b8400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88807c8b8480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807c8b8500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807c8b8580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: e5 ef in $0xef,%eax 2: b1 7e mov $0x7e,%cl 4: 25 ff ff ff 7f and $0x7fffffff,%eax 9: 39 c3 cmp %eax,%ebx b: 74 03 je 0x10 d: 5b pop %rbx e: 5d pop %rbp f: c3 retq 10: 48 8b 5c 24 10 mov 0x10(%rsp),%rbx 15: 48 89 df mov %rbx,%rdi 18: e8 5c 08 0d 00 callq 0xd0879 1d: 85 c0 test %eax,%eax 1f: 75 35 jne 0x56 21: 65 48 8b 2c 25 00 70 mov %gs:0x27000,%rbp 28: 02 00 * 2a: 48 8d bd 58 14 00 00 lea 0x1458(%rbp),%rdi <-- trapping instruction 31: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax 38: fc ff df 3b: 48 89 fa mov %rdi,%rdx 3e: 48 rex.W 3f: c1 .byte 0xc1