==================================================================
BUG: KASAN: use-after-free in tcp_retransmit_timer+0x720/0x27f0 net/ipv4/tcp_timer.c:511
Read of size 8 at addr ffff8880221f39c0 by task syz-executor.3/22859
CPU: 1 PID: 22859 Comm: syz-executor.3 Not tainted 5.18.0-syzkaller-11972-gd1dc87763f40 #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+0x1e3/0x2cb lib/dump_stack.c:106
print_address_description+0x65/0x4b0 mm/kasan/report.c:313
print_report+0xf4/0x210 mm/kasan/report.c:429
kasan_report+0xfb/0x130 mm/kasan/report.c:491
tcp_retransmit_timer+0x720/0x27f0 net/ipv4/tcp_timer.c:511
tcp_write_timer_handler+0x236/0xa90 net/ipv4/tcp_timer.c:622
tcp_write_timer+0x176/0x280 net/ipv4/tcp_timer.c:642
call_timer_fn+0xf5/0x210 kernel/time/timer.c:1474
expire_timers kernel/time/timer.c:1519 [inline]
__run_timers+0x76a/0x980 kernel/time/timer.c:1790
run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1803
__do_softirq+0x382/0x793 kernel/softirq.c:571
__irq_exit_rcu+0xec/0x170 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+0x1b/0x20
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0xd4/0x130 kernel/locking/spinlock.c:194
Code: 9c 8f 44 24 20 42 80 3c 23 00 74 08 4c 89 f7 e8 52 10 a8 f7 f6 44 24 21 02 75 4e 41 f7 c7 00 02 00 00 74 01 fb bf 01 00 00 00 c7 99 29 f7 65 8b 05 78 0b d0 75 85 c0 74 3f 48 c7 04 24 0e 36
RSP: 0018:ffffc90002edf4c0 EFLAGS: 00000206
RAX: 2cdfa5dcc6d70f00 RBX: 1ffff920005dbe9c RCX: ffffffff81682178
RDX: dffffc0000000000 RSI: ffffffff8a8d2320 RDI: 0000000000000001
RBP: ffffc90002edf550 R08: dffffc0000000000 R09: fffffbfff1f6ba0e
R10: fffffbfff1f6ba0e R11: 1ffffffff1f6ba0d R12: dffffc0000000000
R13: 1ffff920005dbe98 R14: ffffc90002edf4e0 R15: 0000000000000246
spin_unlock_irqrestore include/linux/spinlock.h:404 [inline]
__wake_up_common_lock kernel/sched/wait.c:139 [inline]
__wake_up_sync_key+0x124/0x1c0 kernel/sched/wait.c:204
__unix_dgram_recvmsg+0x5fb/0x1200 net/unix/af_unix.c:2417
____sys_recvmsg+0x285/0x530
___sys_recvmsg net/socket.c:2753 [inline]
do_recvmmsg+0xa29/0x1630 net/socket.c:2847
__sys_recvmmsg net/socket.c:2926 [inline]
__do_sys_recvmmsg net/socket.c:2949 [inline]
__se_sys_recvmmsg net/socket.c:2942 [inline]
__x64_sys_recvmmsg+0x195/0x240 net/socket.c:2942
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x46/0xb0
RIP: 0033:0x7f3c26889109
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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f3c279c1168 EFLAGS: 00000246 ORIG_RAX: 000000000000012b
RAX: ffffffffffffffda RBX: 00007f3c2699c030 RCX: 00007f3c26889109
RDX: 0000000000010106 RSI: 00000000200000c0 RDI: 0000000000000003
RBP: 00007f3c268e308d R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffcb20d5e4f R14: 00007f3c279c1300 R15: 0000000000022000
Allocated by task 3757:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:45 [inline]
set_alloc_info mm/kasan/common.c:436 [inline]
__kasan_slab_alloc+0xb2/0xe0 mm/kasan/common.c:469
kasan_slab_alloc include/linux/kasan.h:224 [inline]
slab_post_alloc_hook mm/slab.h:750 [inline]
slab_alloc_node mm/slub.c:3214 [inline]
slab_alloc mm/slub.c:3222 [inline]
__kmem_cache_alloc_lru mm/slub.c:3229 [inline]
kmem_cache_alloc+0x199/0x2f0 mm/slub.c:3239
kmem_cache_zalloc include/linux/slab.h:723 [inline]
net_alloc net/core/net_namespace.c:403 [inline]
copy_net_ns+0x13c/0x5b0 net/core/net_namespace.c:458
create_new_namespaces+0x4db/0x8e0 kernel/nsproxy.c:110
unshare_nsproxy_namespaces+0x11e/0x180 kernel/nsproxy.c:226
ksys_unshare+0x57f/0xb30 kernel/fork.c:3135
__do_sys_unshare kernel/fork.c:3206 [inline]
__se_sys_unshare kernel/fork.c:3204 [inline]
__x64_sys_unshare+0x34/0x40 kernel/fork.c:3204
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x46/0xb0
Last potentially related work creation:
kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
__kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:348
insert_work+0x54/0x3e0 kernel/workqueue.c:1358
__queue_work+0x969/0xc20 kernel/workqueue.c:1517
call_timer_fn+0xf5/0x210 kernel/time/timer.c:1474
expire_timers kernel/time/timer.c:1514 [inline]
__run_timers+0x7a2/0x980 kernel/time/timer.c:1790
__do_softirq+0x382/0x793 kernel/softirq.c:571
Second to last potentially related work creation:
kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
__kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:348
insert_work+0x54/0x3e0 kernel/workqueue.c:1358
__queue_work+0x969/0xc20 kernel/workqueue.c:1517
call_timer_fn+0xf5/0x210 kernel/time/timer.c:1474
expire_timers kernel/time/timer.c:1514 [inline]
__run_timers+0x7a2/0x980 kernel/time/timer.c:1790
__do_softirq+0x382/0x793 kernel/softirq.c:571
The buggy address belongs to the object at ffff8880221f3700
which belongs to the cache net_namespace of size 6784
The buggy address is located 704 bytes inside of
6784-byte region [ffff8880221f3700, ffff8880221f5180)
The buggy address belongs to the physical page:
page:ffffea0000887c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880221f3700 pfn:0x221f0
head:ffffea0000887c00 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff8880777f4ec1
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0001fc6c08 ffffea0001687808 ffff888140007500
raw: ffff8880221f3700 0000000000040000 00000001ffffffff ffff8880777f4ec1
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 3628, tgid 3628 (syz-executor.1), ts 115298704902, free_ts 95346585637
prep_new_page mm/page_alloc.c:2456 [inline]
get_page_from_freelist+0x72b/0x7a0 mm/page_alloc.c:4198
__alloc_pages+0x259/0x560 mm/page_alloc.c:5426
alloc_slab_page+0x70/0xf0 mm/slub.c:1797
allocate_slab+0x5e/0x520 mm/slub.c:1942
new_slab mm/slub.c:2002 [inline]
___slab_alloc+0x41e/0xcd0 mm/slub.c:3002
__slab_alloc mm/slub.c:3089 [inline]
slab_alloc_node mm/slub.c:3180 [inline]
slab_alloc mm/slub.c:3222 [inline]
__kmem_cache_alloc_lru mm/slub.c:3229 [inline]
kmem_cache_alloc+0x246/0x2f0 mm/slub.c:3239
kmem_cache_zalloc include/linux/slab.h:723 [inline]
net_alloc net/core/net_namespace.c:403 [inline]
copy_net_ns+0x13c/0x5b0 net/core/net_namespace.c:458
create_new_namespaces+0x4db/0x8e0 kernel/nsproxy.c:110
unshare_nsproxy_namespaces+0x11e/0x180 kernel/nsproxy.c:226
ksys_unshare+0x57f/0xb30 kernel/fork.c:3135
__do_sys_unshare kernel/fork.c:3206 [inline]
__se_sys_unshare kernel/fork.c:3204 [inline]
__x64_sys_unshare+0x34/0x40 kernel/fork.c:3204
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x46/0xb0
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1371 [inline]
free_pcp_prepare+0x812/0x900 mm/page_alloc.c:1421
free_unref_page_prepare mm/page_alloc.c:3343 [inline]
free_unref_page+0x7d/0x390 mm/page_alloc.c:3438
do_slab_free mm/slub.c:3495 [inline]
___cache_free+0x118/0x1a0 mm/slub.c:3514
qlist_free_all+0x2b/0x70 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x169/0x180 mm/kasan/quarantine.c:294
__kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:446
kasan_slab_alloc include/linux/kasan.h:224 [inline]
slab_post_alloc_hook mm/slab.h:750 [inline]
slab_alloc_node mm/slub.c:3214 [inline]
kmem_cache_alloc_node+0x1cd/0x340 mm/slub.c:3264
__alloc_skb+0xd5/0x660 net/core/skbuff.c:414
alloc_skb_fclone include/linux/skbuff.h:1476 [inline]
tcp_stream_alloc_skb+0x67/0x480 net/ipv4/tcp.c:862
tcp_sendmsg_locked+0xd64/0x3fc0 net/ipv4/tcp.c:1297
tcp_sendmsg+0x2c/0x40 net/ipv4/tcp.c:1448
sock_sendmsg_nosec net/socket.c:714 [inline]
sock_sendmsg net/socket.c:734 [inline]
sock_write_iter+0x3e7/0x560 net/socket.c:1108
call_write_iter include/linux/fs.h:2060 [inline]
new_sync_write fs/read_write.c:504 [inline]
vfs_write+0xa22/0xd40 fs/read_write.c:591
ksys_write+0x19b/0x2c0 fs/read_write.c:644
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x46/0xb0
Memory state around the buggy address:
ffff8880221f3880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880221f3900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880221f3980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880221f3a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880221f3a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: 9c pushfq
1: 8f 44 24 20 popq 0x20(%rsp)
5: 42 80 3c 23 00 cmpb $0x0,(%rbx,%r12,1)
a: 74 08 je 0x14
c: 4c 89 f7 mov %r14,%rdi
f: e8 52 10 a8 f7 callq 0xf7a81066
14: f6 44 24 21 02 testb $0x2,0x21(%rsp)
19: 75 4e jne 0x69
1b: 41 f7 c7 00 02 00 00 test $0x200,%r15d
22: 74 01 je 0x25
24: fb sti
25: bf 01 00 00 00 mov $0x1,%edi
* 2a: e8 c7 99 29 f7 callq 0xf72999f6 <-- trapping instruction
2f: 65 8b 05 78 0b d0 75 mov %gs:0x75d00b78(%rip),%eax # 0x75d00bae
36: 85 c0 test %eax,%eax
38: 74 3f je 0x79
3a: 48 rex.W
3b: c7 .byte 0xc7
3c: 04 24 add $0x24,%al
3e: 0e (bad)
3f: 36 ss