================================================================== BUG: KASAN: use-after-free in tcp_orphan_retries net/ipv4/tcp_timer.c:127 [inline] BUG: KASAN: use-after-free in tcp_probe_timer net/ipv4/tcp_timer.c:362 [inline] BUG: KASAN: use-after-free in tcp_write_timer_handler+0x889/0x8a0 net/ipv4/tcp_timer.c:591 Read of size 4 at addr ffff888085b1c7e8 by task net.agent/18715 CPU: 1 PID: 18715 Comm: net.agent Not tainted 5.1.0-rc5+ #149 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x172/0x1f0 lib/dump_stack.c:113 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:187 kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317 __asan_report_load4_noabort+0x14/0x20 mm/kasan/generic_report.c:131 tcp_orphan_retries net/ipv4/tcp_timer.c:127 [inline] tcp_probe_timer net/ipv4/tcp_timer.c:362 [inline] tcp_write_timer_handler+0x889/0x8a0 net/ipv4/tcp_timer.c:591 tcp_write_timer+0x10e/0x1d0 net/ipv4/tcp_timer.c:607 call_timer_fn+0x190/0x720 kernel/time/timer.c:1325 expire_timers kernel/time/timer.c:1362 [inline] __run_timers kernel/time/timer.c:1681 [inline] __run_timers kernel/time/timer.c:1649 [inline] run_timer_softirq+0x652/0x1700 kernel/time/timer.c:1694 __do_softirq+0x266/0x95a kernel/softirq.c:293 invoke_softirq kernel/softirq.c:374 [inline] irq_exit+0x180/0x1d0 kernel/softirq.c:414 exiting_irq arch/x86/include/asm/apic.h:536 [inline] smp_apic_timer_interrupt+0x14a/0x570 arch/x86/kernel/apic/apic.c:1062 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:807 RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:767 [inline] RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x95/0xe0 kernel/locking/spinlock.c:184 Code: 48 c7 c0 b0 96 92 88 48 ba 00 00 00 00 00 fc ff df 48 c1 e8 03 80 3c 10 00 75 39 48 83 3d b2 dc 7c 01 00 74 24 48 89 df 57 9d <0f> 1f 44 00 00 bf 01 00 00 00 e8 dc 1e 38 fa 65 8b 05 75 33 ec 78 RSP: 0018:ffff88808e47f960 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff13 RAX: 1ffffffff11252d6 RBX: 0000000000000286 RCX: 0000000000000000 RDX: dffffc0000000000 RSI: 0000000000000006 RDI: 0000000000000286 RBP: ffff88808e47f970 R08: ffff88806988e300 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffff88812ffffb80 R13: 0000000000000032 R14: 0000000000000039 R15: dffffc0000000000 spin_unlock_irqrestore include/linux/spinlock.h:384 [inline] release_pages+0x64b/0x1a50 mm/swap.c:735 free_pages_and_swap_cache+0x2a0/0x3d0 mm/swap_state.c:295 tlb_flush_mmu_free+0x4e/0x120 mm/mmu_gather.c:74 tlb_flush_mmu+0x5a/0x520 mm/mmu_gather.c:83 arch_tlb_finish_mmu+0x3f/0x370 mm/mmu_gather.c:100 tlb_finish_mmu+0x9e/0x100 mm/mmu_gather.c:259 exit_mmap+0x2e2/0x530 mm/mmap.c:3140 __mmput kernel/fork.c:1046 [inline] mmput+0x15f/0x4c0 kernel/fork.c:1067 exit_mm kernel/exit.c:546 [inline] do_exit+0x816/0x2fa0 kernel/exit.c:863 do_group_exit+0x135/0x370 kernel/exit.c:980 __do_sys_exit_group kernel/exit.c:991 [inline] __se_sys_exit_group kernel/exit.c:989 [inline] __x64_sys_exit_group+0x44/0x50 kernel/exit.c:989 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7f96eb0041e8 Code: Bad RIP value. RSP: 002b:00007ffe520c8068 EFLAGS: 00000202 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00007f96eb0041e8 RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000 RBP: 0000000000000000 R08: 00000000000000e7 R09: ffffffffffffffa8 R10: 0000000000000000 R11: 0000000000000202 R12: 000000000040247c R13: 00007ffe520c8330 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 7519: save_stack+0x45/0xd0 mm/kasan/common.c:75 set_track mm/kasan/common.c:87 [inline] __kasan_kmalloc mm/kasan/common.c:497 [inline] __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:470 kasan_slab_alloc+0xf/0x20 mm/kasan/common.c:505 slab_post_alloc_hook mm/slab.h:437 [inline] slab_alloc mm/slab.c:3394 [inline] kmem_cache_alloc+0x11a/0x6f0 mm/slab.c:3556 kmem_cache_zalloc include/linux/slab.h:732 [inline] net_alloc net/core/net_namespace.c:385 [inline] copy_net_ns+0xed/0x340 net/core/net_namespace.c:425 create_new_namespaces+0x400/0x7b0 kernel/nsproxy.c:107 unshare_nsproxy_namespaces+0xc2/0x200 kernel/nsproxy.c:206 ksys_unshare+0x440/0x980 kernel/fork.c:2549 __do_sys_unshare kernel/fork.c:2617 [inline] __se_sys_unshare kernel/fork.c:2615 [inline] __x64_sys_unshare+0x31/0x40 kernel/fork.c:2615 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 9352: save_stack+0x45/0xd0 mm/kasan/common.c:75 set_track mm/kasan/common.c:87 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/common.c:459 kasan_slab_free+0xe/0x10 mm/kasan/common.c:467 __cache_free mm/slab.c:3500 [inline] kmem_cache_free+0x86/0x260 mm/slab.c:3766 net_free net/core/net_namespace.c:401 [inline] net_drop_ns.part.0+0x70/0x90 net/core/net_namespace.c:408 net_drop_ns net/core/net_namespace.c:407 [inline] cleanup_net+0x538/0x960 net/core/net_namespace.c:570 process_one_work+0x98e/0x1790 kernel/workqueue.c:2269 worker_thread+0x98/0xe40 kernel/workqueue.c:2415 kthread+0x357/0x430 kernel/kthread.c:253 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352 The buggy address belongs to the object at ffff888085b1c080 which belongs to the cache net_namespace of size 8640 The buggy address is located 1896 bytes inside of 8640-byte region [ffff888085b1c080, ffff888085b1e240) The buggy address belongs to the page: page:ffffea000216c700 count:1 mapcount:0 mapping:ffff88821bc45e00 index:0x0 compound_mapcount: 0 flags: 0x1fffc0000010200(slab|head) raw: 01fffc0000010200 ffffea0002967508 ffffea0002a3af08 ffff88821bc45e00 raw: 0000000000000000 ffff888085b1c080 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888085b1c680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888085b1c700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888085b1c780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888085b1c800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888085b1c880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================