==================================================================
BUG: KASAN: use-after-free in tcp_retransmit_timer+0x2ef3/0x3360 net/ipv4/tcp_timer.c:511
Read of size 8 at addr ffff888020328380 by task udevd/4158
CPU: 1 PID: 4158 Comm: udevd Not tainted 5.18.0-rc3-syzkaller-00074-gb05a5683eba6-dirty #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+0xcd/0x134 lib/dump_stack.c:106
print_address_description.constprop.0.cold+0xeb/0x467 mm/kasan/report.c:313
print_report mm/kasan/report.c:429 [inline]
kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491
tcp_retransmit_timer+0x2ef3/0x3360 net/ipv4/tcp_timer.c:511
tcp_write_timer_handler+0x5e6/0xbc0 net/ipv4/tcp_timer.c:622
tcp_write_timer+0xa2/0x2b0 net/ipv4/tcp_timer.c:642
call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421
expire_timers kernel/time/timer.c:1466 [inline]
__run_timers.part.0+0x679/0xa80 kernel/time/timer.c:1737
__run_timers kernel/time/timer.c:1715 [inline]
run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1750
__do_softirq+0x29b/0x9c2 kernel/softirq.c:558
invoke_softirq kernel/softirq.c:432 [inline]
__irq_exit_rcu+0x123/0x180 kernel/softirq.c:637
irq_exit_rcu+0x5/0x20 kernel/softirq.c:649
sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1097
asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:645
RIP: 0010:prefetchw arch/x86/include/asm/processor.h:743 [inline]
RIP: 0010:slab_alloc mm/slab.c:3312 [inline]
RIP: 0010:__do_kmalloc mm/slab.c:3708 [inline]
RIP: 0010:__kmalloc+0x1af/0x4d0 mm/slab.c:3719
Code: 0f 84 46 01 00 00 4d 85 f6 48 89 54 24 18 0f 85 dd 01 00 00 9c 58 f6 c4 02 0f 85 fb 01 00 00 4d 85 f6 74 01 fb 48 8b 74 24 18 <0f> 0d 0e 0f 1f 44 00 00 48 83 7b 50 00 0f 84 85 00 00 00 44 8b 35
RSP: 0018:ffffc90003687738 EFLAGS: 00000206
RAX: 0000000000000006 RBX: ffff888010c40900 RCX: 1ffffffff1b6cca9
RDX: 0000000000000000 RSI: ffff88804483a000 RDI: 0000000000000000
RBP: 0000000000000c40 R08: 0000000000000001 R09: 0000000000000001
R10: ffffffff817e0cc8 R11: 0000000000000001 R12: 0000000000001000
R13: 0000000000000c40 R14: 0000000000000200 R15: 0000000000000000
kmalloc include/linux/slab.h:586 [inline]
tomoyo_realpath_from_path+0xc3/0x620 security/tomoyo/realpath.c:254
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_check_open_permission+0x272/0x380 security/tomoyo/file.c:771
tomoyo_file_open security/tomoyo/tomoyo.c:311 [inline]
tomoyo_file_open+0x9d/0xc0 security/tomoyo/tomoyo.c:306
security_file_open+0x45/0xb0 security/security.c:1651
do_dentry_open+0x349/0x11e0 fs/open.c:811
do_open fs/namei.c:3476 [inline]
path_openat+0x1c71/0x2910 fs/namei.c:3609
do_filp_open+0x1aa/0x400 fs/namei.c:3636
do_sys_openat2+0x16d/0x4c0 fs/open.c:1213
do_sys_open fs/open.c:1229 [inline]
__do_sys_openat fs/open.c:1245 [inline]
__se_sys_openat fs/open.c:1240 [inline]
__x64_sys_openat+0x13f/0x1f0 fs/open.c:1240
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f05b0b25697
Code: 25 00 00 41 00 3d 00 00 41 00 74 37 64 8b 04 25 18 00 00 00 85 c0 75 5b 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 85 00 00 00 48 83 c4 68 5d 41 5c c3 0f 1f
RSP: 002b:00007ffe2589e810 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000556cc6fd3150 RCX: 00007f05b0b25697
RDX: 0000000000080000 RSI: 0000556cc6f9d160 RDI: 00000000ffffff9c
RBP: 0000556cc6f9d160 R08: 0000556cc6f9d160 R09: 00007f05b0bf5a60
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000080000
R13: 0000000000000705 R14: 0000000000000000 R15: 0000000000000000
Allocated by task 3894:
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+0x85/0xb0 mm/kasan/common.c:469
kasan_slab_alloc include/linux/kasan.h:224 [inline]
slab_post_alloc_hook mm/slab.h:749 [inline]
slab_alloc mm/slab.c:3316 [inline]
__kmem_cache_alloc_lru mm/slab.c:3493 [inline]
kmem_cache_alloc+0x265/0x560 mm/slab.c:3513
kmem_cache_zalloc include/linux/slab.h:704 [inline]
net_alloc net/core/net_namespace.c:403 [inline]
copy_net_ns+0x125/0x760 net/core/net_namespace.c:458
create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110
unshare_nsproxy_namespaces+0xc1/0x1f0 kernel/nsproxy.c:226
ksys_unshare+0x445/0x920 kernel/fork.c:3132
__do_sys_unshare kernel/fork.c:3203 [inline]
__se_sys_unshare kernel/fork.c:3201 [inline]
__x64_sys_unshare+0x2d/0x40 kernel/fork.c:3201
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae
Freed by task 50:
kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
kasan_set_track+0x21/0x30 mm/kasan/common.c:45
kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370
____kasan_slab_free mm/kasan/common.c:366 [inline]
____kasan_slab_free+0x13d/0x180 mm/kasan/common.c:328
kasan_slab_free include/linux/kasan.h:200 [inline]
__cache_free mm/slab.c:3439 [inline]
kmem_cache_free.part.0+0xa9/0x240 mm/slab.c:3749
net_free net/core/net_namespace.c:432 [inline]
net_free net/core/net_namespace.c:428 [inline]
cleanup_net+0x8ba/0xb00 net/core/net_namespace.c:615
process_one_work+0x996/0x1610 kernel/workqueue.c:2289
worker_thread+0x665/0x1080 kernel/workqueue.c:2436
kthread+0x2e9/0x3a0 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
Last potentially related work creation:
kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
__kasan_record_aux_stack+0x7e/0x90 mm/kasan/generic.c:348
insert_work+0x48/0x350 kernel/workqueue.c:1358
__queue_work+0x62e/0x1140 kernel/workqueue.c:1517
call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421
expire_timers kernel/time/timer.c:1461 [inline]
__run_timers.part.0+0x4a3/0xa80 kernel/time/timer.c:1737
__run_timers kernel/time/timer.c:1715 [inline]
run_timer_softirq+0x152/0x1d0 kernel/time/timer.c:1752
__do_softirq+0x29b/0x9c2 kernel/softirq.c:558
Second to last potentially related work creation:
kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
__kasan_record_aux_stack+0x7e/0x90 mm/kasan/generic.c:348
insert_work+0x48/0x350 kernel/workqueue.c:1358
__queue_work+0x62e/0x1140 kernel/workqueue.c:1517
call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421
expire_timers kernel/time/timer.c:1461 [inline]
__run_timers.part.0+0x4a3/0xa80 kernel/time/timer.c:1737
__run_timers kernel/time/timer.c:1715 [inline]
run_timer_softirq+0x152/0x1d0 kernel/time/timer.c:1752
__do_softirq+0x29b/0x9c2 kernel/softirq.c:558
The buggy address belongs to the object at ffff8880203280c0
which belongs to the cache net_namespace of size 6784
The buggy address is located 704 bytes inside of
6784-byte region [ffff8880203280c0, ffff888020329b40)
The buggy address belongs to the physical page:
page:ffffea000080ca00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x20328
head:ffffea000080ca00 order:1 compound_mapcount:0 compound_pincount:0
memcg:ffff88801605c281
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea00008ef008 ffffea0001f97108 ffff8880114d3600
raw: 0000000000000000 ffff8880203280c0 0000000100000001 ffff88801605c281
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Unmovable, gfp_mask 0x3420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_HARDWALL|__GFP_THISNODE), pid 3894, tgid 3894 (syz-executor.3), ts 65729083336, free_ts 62504832892
prep_new_page mm/page_alloc.c:2441 [inline]
get_page_from_freelist+0xba2/0x3e00 mm/page_alloc.c:4182
__alloc_pages+0x1b2/0x500 mm/page_alloc.c:5408
__alloc_pages_node include/linux/gfp.h:587 [inline]
kmem_getpages mm/slab.c:1378 [inline]
cache_grow_begin+0x75/0x350 mm/slab.c:2584
cache_alloc_refill+0x27f/0x380 mm/slab.c:2957
____cache_alloc mm/slab.c:3040 [inline]
____cache_alloc mm/slab.c:3023 [inline]
__do_cache_alloc mm/slab.c:3267 [inline]
slab_alloc mm/slab.c:3309 [inline]
__kmem_cache_alloc_lru mm/slab.c:3493 [inline]
kmem_cache_alloc+0x450/0x560 mm/slab.c:3513
kmem_cache_zalloc include/linux/slab.h:704 [inline]
net_alloc net/core/net_namespace.c:403 [inline]
copy_net_ns+0x125/0x760 net/core/net_namespace.c:458
create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110
unshare_nsproxy_namespaces+0xc1/0x1f0 kernel/nsproxy.c:226
ksys_unshare+0x445/0x920 kernel/fork.c:3132
__do_sys_unshare kernel/fork.c:3203 [inline]
__se_sys_unshare kernel/fork.c:3201 [inline]
__x64_sys_unshare+0x2d/0x40 kernel/fork.c:3201
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1356 [inline]
free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1406
free_unref_page_prepare mm/page_alloc.c:3328 [inline]
free_unref_page+0x19/0x6a0 mm/page_alloc.c:3423
slab_destroy mm/slab.c:1630 [inline]
slabs_destroy+0x89/0xc0 mm/slab.c:1650
cache_flusharray mm/slab.c:3411 [inline]
___cache_free+0x34e/0x670 mm/slab.c:3474
qlink_free mm/kasan/quarantine.c:157 [inline]
qlist_free_all+0x4f/0x1b0 mm/kasan/quarantine.c:176
kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:283
__kasan_slab_alloc+0x97/0xb0 mm/kasan/common.c:446
kasan_slab_alloc include/linux/kasan.h:224 [inline]
slab_post_alloc_hook mm/slab.h:749 [inline]
slab_alloc_node mm/slab.c:3253 [inline]
kmem_cache_alloc_node+0x2ea/0x590 mm/slab.c:3607
__alloc_skb+0x215/0x340 net/core/skbuff.c:414
alloc_skb include/linux/skbuff.h:1300 [inline]
alloc_skb_with_frags+0x93/0x730 net/core/skbuff.c:5995
sock_alloc_send_pskb+0x793/0x920 net/core/sock.c:2600
unix_dgram_sendmsg+0x414/0x1a90 net/unix/af_unix.c:1896
sock_sendmsg_nosec net/socket.c:705 [inline]
sock_sendmsg+0xcf/0x120 net/socket.c:725
sock_write_iter+0x283/0x3c0 net/socket.c:1061
call_write_iter include/linux/fs.h:2050 [inline]
new_sync_write+0x38a/0x560 fs/read_write.c:504
vfs_write+0x7c0/0xac0 fs/read_write.c:591
Memory state around the buggy address:
ffff888020328280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888020328300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888020328380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888020328400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888020328480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: 0f 84 46 01 00 00 je 0x14c
6: 4d 85 f6 test %r14,%r14
9: 48 89 54 24 18 mov %rdx,0x18(%rsp)
e: 0f 85 dd 01 00 00 jne 0x1f1
14: 9c pushfq
15: 58 pop %rax
16: f6 c4 02 test $0x2,%ah
19: 0f 85 fb 01 00 00 jne 0x21a
1f: 4d 85 f6 test %r14,%r14
22: 74 01 je 0x25
24: fb sti
25: 48 8b 74 24 18 mov 0x18(%rsp),%rsi
* 2a: 0f 0d 0e prefetchw (%rsi) <-- trapping instruction
2d: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
32: 48 83 7b 50 00 cmpq $0x0,0x50(%rbx)
37: 0f 84 85 00 00 00 je 0xc2
3d: 44 rex.R
3e: 8b .byte 0x8b
3f: 35 .byte 0x35