==================================================================
BUG: KASAN: use-after-free in tcp_probe_timer net/ipv4/tcp_timer.c:384 [inline]
BUG: KASAN: use-after-free in tcp_write_timer_handler+0x882/0x9c0 net/ipv4/tcp_timer.c:648
Read of size 1 at addr ffff8880155b068d by task syz.3.3543/12907
CPU: 1 PID: 12907 Comm: syz.3.3543 Not tainted 5.15.162-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2d0 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_probe_timer net/ipv4/tcp_timer.c:384 [inline]
tcp_write_timer_handler+0x882/0x9c0 net/ipv4/tcp_timer.c:648
tcp_write_timer+0x12e/0x280 net/ipv4/tcp_timer.c:664
call_timer_fn+0x16d/0x560 kernel/time/timer.c:1451
expire_timers kernel/time/timer.c:1496 [inline]
__run_timers+0x67c/0x890 kernel/time/timer.c:1767
run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1780
handle_softirqs+0x3a7/0x930 kernel/softirq.c:558
__do_softirq kernel/softirq.c:592 [inline]
invoke_softirq kernel/softirq.c:432 [inline]
__irq_exit_rcu+0x157/0x240 kernel/softirq.c:641
irq_exit_rcu+0x5/0x20 kernel/softirq.c:653
sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1096
asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:638
RIP: 0010:native_save_fl arch/x86/include/asm/irqflags.h:22 [inline]
RIP: 0010:arch_local_save_flags arch/x86/include/asm/irqflags.h:70 [inline]
RIP: 0010:arch_local_irq_save arch/x86/include/asm/irqflags.h:106 [inline]
RIP: 0010:__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:108 [inline]
RIP: 0010:_raw_spin_lock_irqsave+0x65/0x120 kernel/locking/spinlock.c:162
Code: b5 41 48 c7 44 24 08 2a 55 14 8c 48 c7 44 24 10 60 f9 27 8a 49 89 e5 49 c1 ed 03 48 b8 f1 f1 f1 f1 00 f3 f3 f3 4b 89 44 3d 00 <4c> 89 e3 48 c1 eb 03 42 80 3c 3b 00 74 08 4c 89 e7 e8 f5 30 a2 f7
RSP: 0018:ffffc90002f175c0 EFLAGS: 00000a06
RAX: f3f3f300f1f1f1f1 RBX: 0000000000000000 RCX: 000000000000c4f0
RDX: 0000000000000000 RSI: ffffffff8a8c2e60 RDI: ffffffff9160b398
RBP: ffffc90002f17650 R08: ffffffff842ca752 R09: ffffed100e6c8f26
R10: 0000000000000000 R11: dffffc0000000001 R12: ffffc90002f175e0
R13: 1ffff920005e2eb8 R14: ffffffff9160b398 R15: dffffc0000000000
debug_object_activate+0x63/0x4e0 lib/debugobjects.c:693
debug_rcu_head_queue kernel/rcu/rcu.h:176 [inline]
__call_rcu kernel/rcu/tree.c:2991 [inline]
call_rcu+0x93/0xa70 kernel/rcu/tree.c:3087
radix_tree_node_free lib/radix-tree.c:308 [inline]
delete_node+0x1ac/0x770 lib/radix-tree.c:571
radix_tree_delete_item+0x2dc/0x3f0 lib/radix-tree.c:1428
kernfs_put+0x2f2/0x4a0 fs/kernfs/dir.c:545
kernfs_remove_by_name_ns+0x99/0x100 fs/kernfs/dir.c:1567
kernfs_remove_by_name include/linux/kernfs.h:598 [inline]
remove_files fs/sysfs/group.c:28 [inline]
sysfs_remove_group+0xfa/0x2a0 fs/sysfs/group.c:289
sysfs_remove_groups+0x50/0xa0 fs/sysfs/group.c:313
device_del+0x6da/0xbd0 drivers/base/core.c:3599
unregister_netdevice_many+0x13a6/0x18f0 net/core/dev.c:11121
unregister_netdevice_queue+0x2e6/0x350 net/core/dev.c:11027
unregister_netdevice include/linux/netdevice.h:3012 [inline]
__tun_detach+0x6b6/0x1600 drivers/net/tun.c:686
tun_detach drivers/net/tun.c:702 [inline]
tun_chr_close+0x104/0x1b0 drivers/net/tun.c:3437
__fput+0x3bf/0x890 fs/file_table.c:280
task_work_run+0x129/0x1a0 kernel/task_work.c:164
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:181
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214
__syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
syscall_exit_to_user_mode+0x5d/0x240 kernel/entry/common.c:307
do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f8ace278bd9
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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe32664b38 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 000000000004fdea RCX: 00007f8ace278bd9
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: ffffffffffffffff R08: 0000000000000001 R09: 0000000a32664e5f
R10: 00007f8ace103000 R11: 0000000000000246 R12: 00007f8ace406f6c
R13: 0000000000000032 R14: 00007f8ace408a60 R15: 00007f8ace406f60
Allocated by task 3503:
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:408 [inline]
copy_net_ns+0x140/0x5d0 net/core/net_namespace.c:463
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:3101
__do_sys_unshare kernel/fork.c:3175 [inline]
__se_sys_unshare kernel/fork.c:3173 [inline]
__x64_sys_unshare+0x34/0x40 kernel/fork.c:3173
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
The buggy address belongs to the object at ffff8880155b0000
which belongs to the cache net_namespace of size 6528
The buggy address is located 1677 bytes inside of
6528-byte region [ffff8880155b0000, ffff8880155b1980)
The buggy address belongs to the page:
page:ffffea0000556c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880155b3500 pfn:0x155b0
head:ffffea0000556c00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffff888011ded288 ffffea0001e91408 ffff888011dec3c0
raw: ffff8880155b3500 0000000000040000 00000001ffffffff 0000000000000000
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 3503, ts 51795050594, free_ts 51791661700
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:5423
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:408 [inline]
copy_net_ns+0x140/0x5d0 net/core/net_namespace.c:463
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:3101
__do_sys_unshare kernel/fork.c:3175 [inline]
__se_sys_unshare kernel/fork.c:3173 [inline]
__x64_sys_unshare+0x34/0x40 kernel/fork.c:3173
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
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
shmem_alloc_inode+0x16/0x30 mm/shmem.c:3792
alloc_inode fs/inode.c:236 [inline]
new_inode_pseudo+0x60/0x210 fs/inode.c:937
new_inode+0x25/0x1d0 fs/inode.c:966
shmem_get_inode+0x327/0xad0 mm/shmem.c:2293
shmem_mknod+0x54/0x1b0 mm/shmem.c:2853
lookup_open fs/namei.c:3462 [inline]
open_last_lookups fs/namei.c:3532 [inline]
path_openat+0x130a/0x2f20 fs/namei.c:3739
Memory state around the buggy address:
ffff8880155b0580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880155b0600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880155b0680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880155b0700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880155b0780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: b5 41 mov $0x41,%ch
2: 48 c7 44 24 08 2a 55 movq $0xffffffff8c14552a,0x8(%rsp)
9: 14 8c
b: 48 c7 44 24 10 60 f9 movq $0xffffffff8a27f960,0x10(%rsp)
12: 27 8a
14: 49 89 e5 mov %rsp,%r13
17: 49 c1 ed 03 shr $0x3,%r13
1b: 48 b8 f1 f1 f1 f1 00 movabs $0xf3f3f300f1f1f1f1,%rax
22: f3 f3 f3
25: 4b 89 44 3d 00 mov %rax,0x0(%r13,%r15,1)
* 2a: 4c 89 e3 mov %r12,%rbx <-- trapping instruction
2d: 48 c1 eb 03 shr $0x3,%rbx
31: 42 80 3c 3b 00 cmpb $0x0,(%rbx,%r15,1)
36: 74 08 je 0x40
38: 4c 89 e7 mov %r12,%rdi
3b: e8 f5 30 a2 f7 call 0xf7a23135