==================================================================
BUG: KASAN: use-after-free in tcp_retransmit_timer+0x2f97/0x3410 net/ipv4/tcp_timer.c:509
Read of size 8 at addr ffff888079f29f00 by task syz-executor.5/9688
CPU: 0 PID: 9688 Comm: syz-executor.5 Not tainted 6.1.0-rc7-syzkaller-00123-ga4412fdd49dc #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x15e/0x45d mm/kasan/report.c:395
kasan_report+0xbf/0x1f0 mm/kasan/report.c:495
tcp_retransmit_timer+0x2f97/0x3410 net/ipv4/tcp_timer.c:509
tcp_write_timer_handler net/ipv4/tcp_timer.c:620 [inline]
tcp_write_timer_handler+0x4e2/0x9f0 net/ipv4/tcp_timer.c:594
tcp_write_timer+0xa6/0x2b0 net/ipv4/tcp_timer.c:637
call_timer_fn+0x1da/0x7c0 kernel/time/timer.c:1474
expire_timers kernel/time/timer.c:1519 [inline]
__run_timers.part.0+0x6a2/0xaf0 kernel/time/timer.c:1790
__run_timers kernel/time/timer.c:1768 [inline]
run_timer_softirq+0xb7/0x1d0 kernel/time/timer.c:1803
__do_softirq+0x1fb/0xadc kernel/softirq.c:571
invoke_softirq kernel/softirq.c:445 [inline]
__irq_exit_rcu+0x123/0x180 kernel/softirq.c:650
irq_exit_rcu+0x9/0x20 kernel/softirq.c:662
sysvec_apic_timer_interrupt+0x97/0xc0 arch/x86/kernel/apic/apic.c:1107
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:649
RIP: 0010:lock_acquire+0x227/0x630 kernel/locking/lockdep.c:5636
Code: 79 9f 7e 83 f8 01 0f 85 3a 03 00 00 9c 58 f6 c4 02 0f 85 25 03 00 00 48 83 7c 24 08 00 74 01 fb 48 b8 00 00 00 00 00 fc ff df <48> 01 c3 48 c7 03 00 00 00 00 48 c7 43 08 00 00 00 00 48 8b 84 24
RSP: 0000:ffffc900036bf9e8 EFLAGS: 00000206
RAX: dffffc0000000000 RBX: 1ffff920006d7f40 RCX: 62a3565051cde377
RDX: 1ffff1100fc1b4f1 RSI: 0000000000000001 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: ffffffff910f3a47
R10: fffffbfff221e748 R11: 0000000000000000 R12: 0000000000000002
R13: 0000000000000000 R14: ffffffff8c58fbc0 R15: 0000000000000000
rcu_lock_acquire include/linux/rcupdate.h:304 [inline]
rcu_read_lock include/linux/rcupdate.h:738 [inline]
folio_memcg_lock+0x3e/0x630 mm/memcontrol.c:2098
page_remove_rmap+0x2b/0x1110 mm/rmap.c:1426
wp_page_copy+0x9e0/0x1ca0 mm/memory.c:3219
do_wp_page+0x538/0x1930 mm/memory.c:3487
handle_pte_fault mm/memory.c:4973 [inline]
__handle_mm_fault+0x181b/0x3a40 mm/memory.c:5097
handle_mm_fault+0x1cc/0x780 mm/memory.c:5218
do_user_addr_fault+0x475/0x1210 arch/x86/mm/fault.c:1428
handle_page_fault arch/x86/mm/fault.c:1519 [inline]
exc_page_fault+0x98/0x170 arch/x86/mm/fault.c:1575
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570
RIP: 0033:0x7f35e304a29d
Code: 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 55 48 89 e5 41 57 41 56 49 89 d6 41 55 49 89 f5 41 54 49 89 fc 53 48 81 ec 28 05 00 00 <89> 8d 38 fb ff ff 64 48 8b 04 25 28 00 00 00 48 89 45 c8 48 c7 c0
RSP: 002b:00007ffdeb7d4e20 EFLAGS: 00010202
RAX: 00000000fbad8001 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 00007ffdeb7d5518 RSI: 00007f35e30e7b6c RDI: 00007ffdeb7d5390
RBP: 00007ffdeb7d5370 R08: 0000000000000000 R09: 00007ffdeb7d5480
R10: 00007f35e30e7b6c R11: 0000000000000202 R12: 00007ffdeb7d5390
R13: 00007f35e30e7b6c R14: 00007ffdeb7d5518 R15: 00007ffdeb7d5518
Allocated by task 3674:
kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
kasan_set_track+0x25/0x30 mm/kasan/common.c:52
__kasan_slab_alloc+0x82/0x90 mm/kasan/common.c:325
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook mm/slab.h:737 [inline]
slab_alloc_node mm/slub.c:3398 [inline]
slab_alloc mm/slub.c:3406 [inline]
__kmem_cache_alloc_lru mm/slub.c:3413 [inline]
kmem_cache_alloc+0x2b4/0x3d0 mm/slub.c:3422
kmem_cache_zalloc include/linux/slab.h:679 [inline]
net_alloc net/core/net_namespace.c:410 [inline]
copy_net_ns+0x129/0x760 net/core/net_namespace.c:465
create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110
unshare_nsproxy_namespaces+0xc5/0x1f0 kernel/nsproxy.c:226
ksys_unshare+0x449/0x920 kernel/fork.c:3188
__do_sys_unshare kernel/fork.c:3259 [inline]
__se_sys_unshare kernel/fork.c:3257 [inline]
__x64_sys_unshare+0x31/0x40 kernel/fork.c:3257
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Last potentially related work creation:
kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
__kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:481
insert_work+0x48/0x350 kernel/workqueue.c:1358
__queue_work+0x693/0x13b0 kernel/workqueue.c:1517
call_timer_fn+0x1da/0x7c0 kernel/time/timer.c:1474
expire_timers kernel/time/timer.c:1514 [inline]
__run_timers.part.0+0x4a3/0xaf0 kernel/time/timer.c:1790
__run_timers kernel/time/timer.c:1768 [inline]
run_timer_softirq+0x156/0x1d0 kernel/time/timer.c:1805
__do_softirq+0x1fb/0xadc kernel/softirq.c:571
Second to last potentially related work creation:
kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
__kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:481
insert_work+0x48/0x350 kernel/workqueue.c:1358
__queue_work+0x693/0x13b0 kernel/workqueue.c:1517
call_timer_fn+0x1da/0x7c0 kernel/time/timer.c:1474
expire_timers kernel/time/timer.c:1514 [inline]
__run_timers.part.0+0x4a3/0xaf0 kernel/time/timer.c:1790
__run_timers kernel/time/timer.c:1768 [inline]
run_timer_softirq+0x156/0x1d0 kernel/time/timer.c:1805
__do_softirq+0x1fb/0xadc kernel/softirq.c:571
The buggy address belongs to the object at ffff888079f29c40
which belongs to the cache net_namespace of size 6976
The buggy address is located 704 bytes inside of
6976-byte region [ffff888079f29c40, ffff888079f2b780)
The buggy address belongs to the physical page:
page:ffffea0001e7ca00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888079f29c40 pfn:0x79f28
head:ffffea0001e7ca00 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff888077977741
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0000775c00 dead000000000003 ffff8880121e1500
raw: ffff888079f29c40 0000000080040001 00000001ffffffff ffff888077977741
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 3662, tgid 3662 (syz-executor.2), ts 158765575480, free_ts 158749442610
prep_new_page mm/page_alloc.c:2539 [inline]
get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4291
__alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5558
alloc_pages+0x1aa/0x270 mm/mempolicy.c:2285
alloc_slab_page mm/slub.c:1794 [inline]
allocate_slab+0x213/0x300 mm/slub.c:1939
new_slab mm/slub.c:1992 [inline]
___slab_alloc+0xa91/0x1400 mm/slub.c:3180
__slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3279
slab_alloc_node mm/slub.c:3364 [inline]
slab_alloc mm/slub.c:3406 [inline]
__kmem_cache_alloc_lru mm/slub.c:3413 [inline]
kmem_cache_alloc+0x31a/0x3d0 mm/slub.c:3422
kmem_cache_zalloc include/linux/slab.h:679 [inline]
net_alloc net/core/net_namespace.c:410 [inline]
copy_net_ns+0x129/0x760 net/core/net_namespace.c:465
create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110
unshare_nsproxy_namespaces+0xc5/0x1f0 kernel/nsproxy.c:226
ksys_unshare+0x449/0x920 kernel/fork.c:3188
__do_sys_unshare kernel/fork.c:3259 [inline]
__se_sys_unshare kernel/fork.c:3257 [inline]
__x64_sys_unshare+0x31/0x40 kernel/fork.c:3257
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1459 [inline]
free_pcp_prepare+0x65c/0xd90 mm/page_alloc.c:1509
free_unref_page_prepare mm/page_alloc.c:3387 [inline]
free_unref_page+0x1d/0x4d0 mm/page_alloc.c:3483
__unfreeze_partials+0x17c/0x1a0 mm/slub.c:2586
qlink_free mm/kasan/quarantine.c:168 [inline]
qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x184/0x210 mm/kasan/quarantine.c:294
__kasan_slab_alloc+0x66/0x90 mm/kasan/common.c:302
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook mm/slab.h:737 [inline]
slab_alloc_node mm/slub.c:3398 [inline]
__kmem_cache_alloc_node+0x2e2/0x3e0 mm/slub.c:3437
__do_kmalloc_node mm/slab_common.c:954 [inline]
__kmalloc+0x4a/0xd0 mm/slab_common.c:968
kmalloc include/linux/slab.h:558 [inline]
tomoyo_realpath_from_path+0xc3/0x600 security/tomoyo/realpath.c:251
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_check_open_permission+0x27a/0x380 security/tomoyo/file.c:771
tomoyo_file_open security/tomoyo/tomoyo.c:320 [inline]
tomoyo_file_open+0xa1/0xc0 security/tomoyo/tomoyo.c:315
security_file_open+0x49/0xb0 security/security.c:1648
do_dentry_open+0x575/0x13f0 fs/open.c:869
do_open fs/namei.c:3557 [inline]
path_openat+0x1bf6/0x2860 fs/namei.c:3714
do_filp_open+0x1ba/0x410 fs/namei.c:3741
do_sys_openat2+0x16d/0x4c0 fs/open.c:1310
Memory state around the buggy address:
ffff888079f29e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888079f29e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888079f29f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888079f29f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888079f2a000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: 79 9f jns 0xffffffa1
2: 7e 83 jle 0xffffff87
4: f8 clc
5: 01 0f add %ecx,(%rdi)
7: 85 3a test %edi,(%rdx)
9: 03 00 add (%rax),%eax
b: 00 9c 58 f6 c4 02 0f add %bl,0xf02c4f6(%rax,%rbx,2)
12: 85 25 03 00 00 48 test %esp,0x48000003(%rip) # 0x4800001b
18: 83 7c 24 08 00 cmpl $0x0,0x8(%rsp)
1d: 74 01 je 0x20
1f: fb sti
20: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
27: fc ff df
* 2a: 48 01 c3 add %rax,%rbx <-- trapping instruction
2d: 48 c7 03 00 00 00 00 movq $0x0,(%rbx)
34: 48 c7 43 08 00 00 00 movq $0x0,0x8(%rbx)
3b: 00
3c: 48 rex.W
3d: 8b .byte 0x8b
3e: 84 .byte 0x84
3f: 24 .byte 0x24