================================================================== BUG: KASAN: use-after-free in inet_twsk_kill+0x358/0x3c0 net/ipv4/inet_timewait_sock.c:46 Read of size 8 at addr ffff88803e6c0440 by task syz-executor.2/158554 CPU: 1 PID: 158554 Comm: syz-executor.2 Not tainted 5.17.0-rc1-next-20220127 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x8b/0xb3 lib/dump_stack.c:106 print_address_description.constprop.0+0x1f/0x190 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x7f/0x11b mm/kasan/report.c:459 inet_twsk_kill+0x358/0x3c0 net/ipv4/inet_timewait_sock.c:46 call_timer_fn+0x182/0x600 kernel/time/timer.c:1421 expire_timers kernel/time/timer.c:1466 [inline] __run_timers.part.0+0x666/0xa00 kernel/time/timer.c:1734 __run_timers kernel/time/timer.c:1715 [inline] run_timer_softirq+0xae/0x1a0 kernel/time/timer.c:1747 __do_softirq+0x270/0x8c7 kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x113/0x170 kernel/softirq.c:637 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649 sysvec_apic_timer_interrupt+0x8e/0xc0 arch/x86/kernel/apic/apic.c:1097 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:638 RIP: 0010:__raw_spin_unlock_irq include/linux/spinlock_api_smp.h:160 [inline] RIP: 0010:_raw_spin_unlock_irq+0x25/0x40 kernel/locking/spinlock.c:202 Code: 0f 1f 44 00 00 55 48 8b 74 24 08 48 89 fd 48 83 c7 18 e8 7e d8 1e fd 48 89 ef e8 e6 53 1f fd e8 01 fb 3f fd fb bf 01 00 00 00 c6 0f 15 fd 65 8b 05 ef 5e f8 7b 85 c0 74 02 5d c3 0f 1f 44 00 RSP: 0018:ffff88803da27798 EFLAGS: 00000206 RAX: 000000000003fae1 RBX: ffff88801f7bf0a8 RCX: 1ffffffff0d470fe RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000001 RBP: ffff88801f7bf0b0 R08: 0000000000000001 R09: ffffffff86a1485f R10: fffffbfff0d4290b R11: 0000000000000001 R12: 0000000000000000 R13: 0000000000000000 R14: ffff88801f7bf0b0 R15: 0000000000000000 spin_unlock_irq include/linux/spinlock.h:404 [inline] __remove_mapping+0x555/0x10f0 mm/vmscan.c:1318 remove_mapping+0x1f/0x260 mm/vmscan.c:1344 invalidate_complete_page mm/truncate.c:214 [inline] invalidate_inode_page+0x3bf/0x450 mm/truncate.c:312 __invalidate_mapping_pages+0x1d7/0x320 mm/truncate.c:526 ext4_dio_write_iter fs/ext4/file.c:600 [inline] ext4_file_write_iter+0xc45/0x1890 fs/ext4/file.c:675 call_write_iter include/linux/fs.h:2074 [inline] do_iter_readv_writev+0x481/0x760 fs/read_write.c:726 do_iter_write+0x18d/0x700 fs/read_write.c:852 vfs_writev+0x1aa/0x630 fs/read_write.c:925 do_pwritev fs/read_write.c:1022 [inline] __do_sys_pwritev fs/read_write.c:1069 [inline] __se_sys_pwritev fs/read_write.c:1064 [inline] __x64_sys_pwritev+0x231/0x310 fs/read_write.c:1064 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7fc162019b19 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fc15f58f188 EFLAGS: 00000246 ORIG_RAX: 0000000000000128 RAX: ffffffffffffffda RBX: 00007fc16212cf60 RCX: 00007fc162019b19 RDX: 0000000000000002 RSI: 0000000020000240 RDI: 0000000000000004 RBP: 00007fc162073f6d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc741738cf R14: 00007fc15f58f300 R15: 0000000000022000 Allocated by task 78387: 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:436 [inline] __kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:469 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+0x1aa/0x480 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/0xb30 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0xc1/0x1f0 kernel/nsproxy.c:226 ksys_unshare+0x445/0x8d0 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+0x3b/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88803e6c0000 which belongs to the cache net_namespace of size 5056 The buggy address is located 1088 bytes inside of 5056-byte region [ffff88803e6c0000, ffff88803e6c13c0) The buggy address belongs to the page: page:00000000e2ab29fc refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3e6c0 head:00000000e2ab29fc order:3 compound_mapcount:0 compound_pincount:0 memcg:ffff88800feb8581 flags: 0x100000000010200(slab|head|node=0|zone=1) raw: 0100000000010200 0000000000000000 dead000000000122 ffff88800805d640 raw: 0000000000000000 0000000080060006 00000001ffffffff ffff88800feb8581 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88803e6c0300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88803e6c0380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88803e6c0400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88803e6c0480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88803e6c0500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== EXT4-fs warning (device sda): __ext4_ioctl:1175: Setting inode version is not supported with metadata_csum enabled. mac80211_hwsim: wmediumd released netlink socket, switching to perfect channel medium mac80211_hwsim: wmediumd released netlink socket, switching to perfect channel medium mac80211_hwsim: wmediumd released netlink socket, switching to perfect channel medium netlink: 8 bytes leftover after parsing attributes in process `syz-executor.3'. mac80211_hwsim: wmediumd released netlink socket, switching to perfect channel medium mac80211_hwsim: wmediumd released netlink socket, switching to perfect channel medium netlink: 8 bytes leftover after parsing attributes in process `syz-executor.3'. netlink: 8 bytes leftover after parsing attributes in process `syz-executor.3'. mac80211_hwsim: wmediumd released netlink socket, switching to perfect channel medium mac80211_hwsim: wmediumd released netlink socket, switching to perfect channel medium netlink: 8 bytes leftover after parsing attributes in process `syz-executor.3'. mac80211_hwsim: wmediumd released netlink socket, switching to perfect channel medium mac80211_hwsim: wmediumd released netlink socket, switching to perfect channel medium audit: type=1400 audit(1643282337.670:102): avc: denied { map } for pid=160262 comm="syz-executor.3" path="pipe:[114649]" dev="pipefs" ino=114649 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=fifo_file permissive=1 netlink: 4 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.5'. ---------------- Code disassembly (best guess): 0: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) 5: 55 push %rbp 6: 48 8b 74 24 08 mov 0x8(%rsp),%rsi b: 48 89 fd mov %rdi,%rbp e: 48 83 c7 18 add $0x18,%rdi 12: e8 7e d8 1e fd callq 0xfd1ed895 17: 48 89 ef mov %rbp,%rdi 1a: e8 e6 53 1f fd callq 0xfd1f5405 1f: e8 01 fb 3f fd callq 0xfd3ffb25 24: fb sti 25: bf 01 00 00 00 mov $0x1,%edi * 2a: e8 c6 0f 15 fd callq 0xfd150ff5 <-- trapping instruction 2f: 65 8b 05 ef 5e f8 7b mov %gs:0x7bf85eef(%rip),%eax # 0x7bf85f25 36: 85 c0 test %eax,%eax 38: 74 02 je 0x3c 3a: 5d pop %rbp 3b: c3 retq 3c: 0f .byte 0xf 3d: 1f (bad) 3e: 44 rex.R