==================================================================
BUG: KASAN: use-after-free in tcp_retransmit_timer+0x6ee/0x2890 net/ipv4/tcp_timer.c:515
Read of size 8 at addr ffff88805416b6d8 by task sed/9441
CPU: 1 PID: 9441 Comm: sed Not tainted 5.15.107-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/30/2023
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_address_description+0x63/0x3b0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
tcp_retransmit_timer+0x6ee/0x2890 net/ipv4/tcp_timer.c:515
tcp_write_timer_handler+0x1f7/0x9c0 net/ipv4/tcp_timer.c:626
tcp_write_timer+0x12e/0x280 net/ipv4/tcp_timer.c:646
call_timer_fn+0x16d/0x560 kernel/time/timer.c:1421
expire_timers kernel/time/timer.c:1466 [inline]
__run_timers+0x67c/0x890 kernel/time/timer.c:1737
run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1750
__do_softirq+0x3b3/0x93a kernel/softirq.c:558
invoke_softirq kernel/softirq.c:432 [inline]
__irq_exit_rcu+0x155/0x240 kernel/softirq.c:636
irq_exit_rcu+0x5/0x20 kernel/softirq.c:648
sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1097
asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:638
RIP: 0010:finish_lock_switch+0x91/0x100 kernel/sched/core.c:4781
Code: 45 31 c9 68 f7 1f 59 81 e8 2c 17 09 00 48 83 c4 08 4c 89 ff e8 40 d9 fe ff 66 90 4c 89 ff e8 f6 3a c7 08 e8 11 0a 2d 00 fb 5b <41> 5c 41 5d 41 5e 41 5f c3 44 89 f1 80 e1 07 80 c1 03 38 c1 7c 87
RSP: 0018:ffffc9000313f598 EFLAGS: 00000286
RAX: e758b376823e8500 RBX: ffff88807d259d34 RCX: ffffffff913aef03
RDX: dffffc0000000000 RSI: ffffffff8a8af0e0 RDI: ffffffff8ad85240
RBP: ffffc9000313f610 R08: ffffffff81862a70 R09: ffffed10173672d1
R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000
R13: 1ffff1101736747b R14: ffff8880b9b3a3d8 R15: ffff8880b9b39680
finish_task_switch+0x134/0x630 kernel/sched/core.c:4898
context_switch kernel/sched/core.c:5029 [inline]
__schedule+0x12cc/0x4590 kernel/sched/core.c:6372
preempt_schedule_common+0x83/0xd0 kernel/sched/core.c:6548
preempt_schedule+0xd9/0xe0 kernel/sched/core.c:6573
preempt_schedule_thunk+0x16/0x18 arch/x86/entry/thunk_64.S:34
__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:161 [inline]
_raw_spin_unlock_irqrestore+0x128/0x130 kernel/locking/spinlock.c:194
spin_unlock_irqrestore include/linux/spinlock.h:418 [inline]
__wake_up_common_lock kernel/sched/wait.c:140 [inline]
__wake_up_sync_key+0x121/0x1c0 kernel/sched/wait.c:205
pipe_write+0x11f9/0x1b60 fs/pipe.c:593
call_write_iter include/linux/fs.h:2103 [inline]
new_sync_write fs/read_write.c:507 [inline]
vfs_write+0xacf/0xe50 fs/read_write.c:594
ksys_write+0x1a2/0x2c0 fs/read_write.c:647
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7fc533c3a9a3
Code: 8b 15 d9 f4 0c 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 64 8b 04 25 18 00 00 00 85 c0 75 14 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 55 c3 0f 1f 40 00 48 83 ec 28 48 89 54 24 18
RSP: 002b:00007ffed083d218 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000025 RCX: 00007fc533c3a9a3
RDX: 0000000000000025 RSI: 000055a1042a3aa0 RDI: 0000000000000001
RBP: 000055a1042a3aa0 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000005 R11: 0000000000000246 R12: 0000000000000025
R13: 00007fc533d0b520 R14: 0000000000000025 R15: 00007fc533d06780
Allocated by task 4553:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
__kasan_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
slab_alloc_node mm/slub.c:3220 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
kmem_cache_zalloc include/linux/slab.h:711 [inline]
net_alloc net/core/net_namespace.c:405 [inline]
copy_net_ns+0x143/0x5d0 net/core/net_namespace.c:460
create_new_namespaces+0x425/0x7a0 kernel/nsproxy.c:110
unshare_nsproxy_namespaces+0x11e/0x170 kernel/nsproxy.c:226
ksys_unshare+0x580/0xb20 kernel/fork.c:3094
__do_sys_unshare kernel/fork.c:3168 [inline]
__se_sys_unshare kernel/fork.c:3166 [inline]
__x64_sys_unshare+0x34/0x40 kernel/fork.c:3166
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
The buggy address belongs to the object at ffff88805416b480
which belongs to the cache net_namespace of size 6464
The buggy address is located 600 bytes inside of
6464-byte region [ffff88805416b480, ffff88805416cdc0)
The buggy address belongs to the page:
page:ffffea0001505a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88805416cec0 pfn:0x54168
head:ffffea0001505a00 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff8880796d7141
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea000152be08 ffffea0001dafe08 ffff888011dc63c0
raw: ffff88805416cec0 0000000000040000 00000001ffffffff ffff8880796d7141
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 4433, ts 102455945336, free_ts 102407115655
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
__alloc_pages+0x272/0x700 mm/page_alloc.c:5421
alloc_slab_page mm/slub.c:1775 [inline]
allocate_slab mm/slub.c:1912 [inline]
new_slab+0xbb/0x4b0 mm/slub.c:1975
___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
__slab_alloc mm/slub.c:3095 [inline]
slab_alloc_node mm/slub.c:3186 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc+0x18e/0x280 mm/slub.c:3233
kmem_cache_zalloc include/linux/slab.h:711 [inline]
net_alloc net/core/net_namespace.c:405 [inline]
copy_net_ns+0x143/0x5d0 net/core/net_namespace.c:460
create_new_namespaces+0x425/0x7a0 kernel/nsproxy.c:110
copy_namespaces+0x365/0x3b0 kernel/nsproxy.c:178
copy_process+0x1841/0x3ef0 kernel/fork.c:2201
kernel_clone+0x210/0x960 kernel/fork.c:2601
__do_sys_clone kernel/fork.c:2718 [inline]
__se_sys_clone kernel/fork.c:2702 [inline]
__x64_sys_clone+0x23f/0x290 kernel/fork.c:2702
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1340 [inline]
free_pcp_prepare mm/page_alloc.c:1391 [inline]
free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
free_slab mm/slub.c:2015 [inline]
discard_slab mm/slub.c:2021 [inline]
__unfreeze_partials+0x1b7/0x210 mm/slub.c:2507
put_cpu_partial+0x132/0x1a0 mm/slub.c:2587
do_slab_free mm/slub.c:3487 [inline]
___cache_free+0xe3/0x100 mm/slub.c:3506
qlist_free_all+0x36/0x90 mm/kasan/quarantine.c:176
kasan_quarantine_reduce+0x162/0x180 mm/kasan/quarantine.c:283
__kasan_slab_alloc+0x2f/0xc0 mm/kasan/common.c:444
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
slab_alloc_node mm/slub.c:3220 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
ptlock_alloc+0x1c/0x60 mm/memory.c:5510
ptlock_init include/linux/mm.h:2230 [inline]
pgtable_pte_page_ctor include/linux/mm.h:2257 [inline]
__pte_alloc_one include/asm-generic/pgalloc.h:66 [inline]
pte_alloc_one+0xd1/0x360 arch/x86/mm/pgtable.c:33
__pte_alloc+0x75/0x210 mm/memory.c:439
do_anonymous_page mm/memory.c:3763 [inline]
handle_pte_fault mm/memory.c:4606 [inline]
__handle_mm_fault mm/memory.c:4743 [inline]
handle_mm_fault+0x4d7f/0x5950 mm/memory.c:4841
do_user_addr_fault arch/x86/mm/fault.c:1397 [inline]
handle_page_fault arch/x86/mm/fault.c:1485 [inline]
exc_page_fault+0x271/0x740 arch/x86/mm/fault.c:1541
asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568
Memory state around the buggy address:
ffff88805416b580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88805416b600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88805416b680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88805416b700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88805416b780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: 45 31 c9 xor %r9d,%r9d
3: 68 f7 1f 59 81 pushq $0xffffffff81591ff7
8: e8 2c 17 09 00 callq 0x91739
d: 48 83 c4 08 add $0x8,%rsp
11: 4c 89 ff mov %r15,%rdi
14: e8 40 d9 fe ff callq 0xfffed959
19: 66 90 xchg %ax,%ax
1b: 4c 89 ff mov %r15,%rdi
1e: e8 f6 3a c7 08 callq 0x8c73b19
23: e8 11 0a 2d 00 callq 0x2d0a39
28: fb sti
29: 5b pop %rbx
* 2a: 41 5c pop %r12 <-- trapping instruction
2c: 41 5d pop %r13
2e: 41 5e pop %r14
30: 41 5f pop %r15
32: c3 retq
33: 44 89 f1 mov %r14d,%ecx
36: 80 e1 07 and $0x7,%cl
39: 80 c1 03 add $0x3,%cl
3c: 38 c1 cmp %al,%cl
3e: 7c 87 jl 0xffffffc7