==================================================================
BUG: KASAN: use-after-free in tcp_or_dccp_get_hashinfo include/net/inet_hashtables.h:181 [inline]
BUG: KASAN: use-after-free in reqsk_queue_unlink+0x320/0x350 net/ipv4/inet_connection_sock.c:913
Read of size 8 at addr ffff888022b63d80 by task dhcpcd-run-hook/12836
CPU: 1 PID: 12836 Comm: dhcpcd-run-hook Not tainted 6.0.0-syzkaller-02752-gd31ada3b5111 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:317 [inline]
print_report.cold+0x2ba/0x719 mm/kasan/report.c:433
kasan_report+0xb1/0x1e0 mm/kasan/report.c:495
tcp_or_dccp_get_hashinfo include/net/inet_hashtables.h:181 [inline]
reqsk_queue_unlink+0x320/0x350 net/ipv4/inet_connection_sock.c:913
inet_csk_reqsk_queue_drop net/ipv4/inet_connection_sock.c:927 [inline]
inet_csk_reqsk_queue_drop_and_put net/ipv4/inet_connection_sock.c:939 [inline]
reqsk_timer_handler+0x724/0x1160 net/ipv4/inet_connection_sock.c:1053
call_timer_fn+0x1a0/0x6b0 kernel/time/timer.c:1474
expire_timers kernel/time/timer.c:1519 [inline]
__run_timers.part.0+0x674/0xa80 kernel/time/timer.c:1790
__run_timers kernel/time/timer.c:1768 [inline]
run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1803
__do_softirq+0x1d0/0x9c8 kernel/softirq.c:571
invoke_softirq kernel/softirq.c:445 [inline]
__irq_exit_rcu+0x123/0x180 kernel/softirq.c:650
irq_exit_rcu+0x5/0x20 kernel/softirq.c:662
sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1107
asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:649
RIP: 0010:__might_sleep+0x1d/0x150 kernel/sched/core.c:9810
Code: ff ff e8 c6 4d 76 00 e9 ec fe ff ff 90 48 b8 00 00 00 00 00 fc ff df 41 54 41 89 f4 55 48 89 fd 53 65 48 8b 1c 25 80 6f 02 00 <48> 8d 7b 18 48 83 ec 10 48 89 fa 48 c1 ea 03 0f b6 04 02 84 c0 74
RSP: 0018:ffffc9000336f940 EFLAGS: 00000206
RAX: dffffc0000000000 RBX: ffff888075430000 RCX: ffffc9000336f8e8
RDX: 0000000000000000 RSI: 0000000000000112 RDI: ffffffff8b8632fe
RBP: ffffffff8b8632fe R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000112
R13: 0000000000000023 R14: 000000000000002e R15: 0000000000000d40
might_alloc include/linux/sched/mm.h:274 [inline]
slab_pre_alloc_hook mm/slab.h:700 [inline]
slab_alloc_node mm/slub.c:3162 [inline]
slab_alloc mm/slub.c:3256 [inline]
__kmalloc+0x254/0x340 mm/slub.c:4425
kmalloc include/linux/slab.h:605 [inline]
kzalloc include/linux/slab.h:733 [inline]
tomoyo_encode2.part.0+0xe9/0x3a0 security/tomoyo/realpath.c:45
tomoyo_encode2 security/tomoyo/realpath.c:31 [inline]
tomoyo_encode+0x28/0x50 security/tomoyo/realpath.c:80
tomoyo_realpath_from_path+0x186/0x620 security/tomoyo/realpath.c:288
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_perm+0x21b/0x400 security/tomoyo/file.c:822
security_inode_getattr+0xcf/0x140 security/security.c:1345
vfs_getattr fs/stat.c:158 [inline]
vfs_statx+0x16e/0x430 fs/stat.c:233
vfs_fstatat+0x8c/0xb0 fs/stat.c:267
__do_sys_newfstatat+0x94/0x120 fs/stat.c:437
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fe7cab0b1da
Code: 48 89 f2 b9 00 01 00 00 48 89 fe bf 9c ff ff ff e9 0b 00 00 00 66 2e 0f 1f 84 00 00 00 00 00 90 41 89 ca b8 06 01 00 00 0f 05 <3d> 00 f0 ff ff 77 07 31 c0 c3 0f 1f 40 00 48 8b 15 69 fc 0c 00 f7
RSP: 002b:00007ffc62602ac8 EFLAGS: 00000206 ORIG_RAX: 0000000000000106
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fe7cab0b1da
RDX: 00007ffc62602ad0 RSI: 00007fe7caba175a RDI: 0000000000000003
RBP: 0000000000000003 R08: 0000000000090800 R09: 000055d379f50040
R10: 0000000000001000 R11: 0000000000000206 R12: 00007ffc62602ad0
R13: 000055d379f4ae38 R14: 000055d379f50067 R15: 000055d379f4ae10
Allocated by task 11597:
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:437 [inline]
__kasan_slab_alloc+0x90/0xc0 mm/kasan/common.c:470
kasan_slab_alloc include/linux/kasan.h:224 [inline]
slab_post_alloc_hook mm/slab.h:727 [inline]
slab_alloc_node mm/slub.c:3248 [inline]
slab_alloc mm/slub.c:3256 [inline]
__kmem_cache_alloc_lru mm/slub.c:3263 [inline]
kmem_cache_alloc+0x267/0x3b0 mm/slub.c:3273
kmem_cache_zalloc include/linux/slab.h:723 [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:3181
__do_sys_unshare kernel/fork.c:3252 [inline]
__se_sys_unshare kernel/fork.c:3250 [inline]
__x64_sys_unshare+0x2d/0x40 kernel/fork.c:3250
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Freed by task 1027:
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:367 [inline]
____kasan_slab_free+0x166/0x1c0 mm/kasan/common.c:329
kasan_slab_free include/linux/kasan.h:200 [inline]
slab_free_hook mm/slub.c:1759 [inline]
slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1785
slab_free mm/slub.c:3539 [inline]
kmem_cache_free+0xeb/0x5b0 mm/slub.c:3556
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+0x991/0x1610 kernel/workqueue.c:2289
worker_thread+0x665/0x1080 kernel/workqueue.c:2436
kthread+0x2e4/0x3a0 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
The buggy address belongs to the object at ffff888022b63880
which belongs to the cache net_namespace of size 6976
The buggy address is located 1280 bytes inside of
6976-byte region [ffff888022b63880, ffff888022b653c0)
The buggy address belongs to the physical page:
page:ffffea00008ad800 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888022b654c0 pfn:0x22b60
head:ffffea00008ad800 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff88804f8c9f41
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0001ddb200 dead000000000003 ffff8880119d43c0
raw: ffff888022b654c0 0000000080040001 00000001ffffffff ffff88804f8c9f41
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 6432, tgid 6399 (syz-executor.0), ts 223225388733, free_ts 223202512853
prep_new_page mm/page_alloc.c:2532 [inline]
get_page_from_freelist+0x109b/0x2ce0 mm/page_alloc.c:4283
__alloc_pages+0x1c7/0x510 mm/page_alloc.c:5549
alloc_pages+0x1a6/0x270 mm/mempolicy.c:2270
alloc_slab_page mm/slub.c:1829 [inline]
allocate_slab+0x27e/0x3d0 mm/slub.c:1974
new_slab mm/slub.c:2034 [inline]
___slab_alloc+0x84f/0xe80 mm/slub.c:3036
__slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3123
slab_alloc_node mm/slub.c:3214 [inline]
slab_alloc mm/slub.c:3256 [inline]
__kmem_cache_alloc_lru mm/slub.c:3263 [inline]
kmem_cache_alloc+0x38c/0x3b0 mm/slub.c:3273
kmem_cache_zalloc include/linux/slab.h:723 [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
copy_namespaces+0x391/0x450 kernel/nsproxy.c:178
copy_process+0x304d/0x7090 kernel/fork.c:2257
kernel_clone+0xe7/0xab0 kernel/fork.c:2671
__do_sys_clone+0xba/0x100 kernel/fork.c:2805
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/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:1449 [inline]
free_pcp_prepare+0x5e4/0xd20 mm/page_alloc.c:1499
free_unref_page_prepare mm/page_alloc.c:3380 [inline]
free_unref_page+0x19/0x4d0 mm/page_alloc.c:3476
__unfreeze_partials+0x17c/0x1a0 mm/slub.c:2553
qlink_free mm/kasan/quarantine.c:168 [inline]
qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:294
__kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:447
kasan_slab_alloc include/linux/kasan.h:224 [inline]
slab_post_alloc_hook mm/slab.h:727 [inline]
slab_alloc_node mm/slub.c:3248 [inline]
slab_alloc mm/slub.c:3256 [inline]
__kmem_cache_alloc_lru mm/slub.c:3263 [inline]
kmem_cache_alloc+0x14a/0x3b0 mm/slub.c:3273
vm_area_alloc+0x1c/0x110 kernel/fork.c:459
mmap_region+0x976/0x1460 mm/mmap.c:1732
do_mmap+0x863/0xfa0 mm/mmap.c:1540
vm_mmap_pgoff+0x1ab/0x270 mm/util.c:552
ksys_mmap_pgoff+0x41b/0x5a0 mm/mmap.c:1586
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Memory state around the buggy address:
ffff888022b63c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888022b63d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888022b63d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888022b63e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888022b63e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess), 2 bytes skipped:
0: e8 c6 4d 76 00 callq 0x764dcb
5: e9 ec fe ff ff jmpq 0xfffffef6
a: 90 nop
b: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
12: fc ff df
15: 41 54 push %r12
17: 41 89 f4 mov %esi,%r12d
1a: 55 push %rbp
1b: 48 89 fd mov %rdi,%rbp
1e: 53 push %rbx
1f: 65 48 8b 1c 25 80 6f mov %gs:0x26f80,%rbx
26: 02 00
* 28: 48 8d 7b 18 lea 0x18(%rbx),%rdi <-- trapping instruction
2c: 48 83 ec 10 sub $0x10,%rsp
30: 48 89 fa mov %rdi,%rdx
33: 48 c1 ea 03 shr $0x3,%rdx
37: 0f b6 04 02 movzbl (%rdx,%rax,1),%eax
3b: 84 c0 test %al,%al
3d: 74 .byte 0x74