==================================================================
BUG: KASAN: use-after-free in decode_session6+0xfc3/0x17f0 net/xfrm/xfrm_policy.c:3373
Read of size 1 at addr ffff888020ca402d by task dhcpcd-run-hook/4954
CPU: 1 PID: 4954 Comm: dhcpcd-run-hook Not tainted 5.18.0-syzkaller-10188-g58f9d52ff689 #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/0x495 mm/kasan/report.c:313
print_report mm/kasan/report.c:429 [inline]
kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491
decode_session6+0xfc3/0x17f0 net/xfrm/xfrm_policy.c:3373
__xfrm_decode_session+0x50/0xb0 net/xfrm/xfrm_policy.c:3479
xfrm_decode_session include/net/xfrm.h:1160 [inline]
vti6_tnl_xmit+0x419/0x1fe0 net/ipv6/ip6_vti.c:577
__netdev_start_xmit include/linux/netdevice.h:4805 [inline]
netdev_start_xmit include/linux/netdevice.h:4819 [inline]
xmit_one net/core/dev.c:3588 [inline]
dev_hard_start_xmit+0x188/0x880 net/core/dev.c:3604
sch_direct_xmit+0x19f/0xbe0 net/sched/sch_generic.c:342
qdisc_restart net/sched/sch_generic.c:407 [inline]
__qdisc_run+0x4c0/0x1720 net/sched/sch_generic.c:415
__dev_xmit_skb net/core/dev.c:3878 [inline]
__dev_queue_xmit+0x217a/0x3900 net/core/dev.c:4219
dev_queue_xmit include/linux/netdevice.h:2994 [inline]
neigh_connected_output+0x3c0/0x520 net/core/neighbour.c:1557
neigh_output include/net/neighbour.h:549 [inline]
ip6_finish_output2+0x564/0x1520 net/ipv6/ip6_output.c:134
__ip6_finish_output net/ipv6/ip6_output.c:195 [inline]
ip6_finish_output+0x844/0x1170 net/ipv6/ip6_output.c:206
NF_HOOK_COND include/linux/netfilter.h:296 [inline]
ip6_output+0x1ed/0x540 net/ipv6/ip6_output.c:227
dst_output include/net/dst.h:451 [inline]
NF_HOOK include/linux/netfilter.h:307 [inline]
ndisc_send_skb+0xa64/0x1740 net/ipv6/ndisc.c:507
ndisc_send_rs+0x12e/0x6f0 net/ipv6/ndisc.c:717
addrconf_rs_timer+0x3f2/0x820 net/ipv6/addrconf.c:3931
call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1474
expire_timers kernel/time/timer.c:1519 [inline]
__run_timers.part.0+0x679/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+0x29b/0x9c2 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:1106
asm_sysvec_apic_timer_interrupt+0x1b/0x20 arch/x86/include/asm/idtentry.h:649
RIP: 0010:preempt_count arch/x86/include/asm/preempt.h:27 [inline]
RIP: 0010:check_kcov_mode kernel/kcov.c:166 [inline]
RIP: 0010:__sanitizer_cov_trace_pc+0x0/0x60 kernel/kcov.c:200
Code: 48 89 ef 5d e9 31 1e 4c 00 5d be 03 00 00 00 e9 46 9d 81 02 66 0f 1f 44 00 00 48 8b be a8 01 00 00 e8 b4 ff ff ff 31 c0 c3 90 <65> 8b 05 e9 ea 87 7e 89 c1 48 8b 34 24 81 e1 00 01 00 00 65 48 8b
RSP: 0018:ffffc900042d7a00 EFLAGS: 00000293
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: ffff88807f753b00 RSI: ffffffff81b2c629 RDI: 0000000000000001
RBP: ffffea000026fbc8 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000009bef025
R13: 00007f4ce93c8000 R14: dffffc0000000000 R15: ffffea000026fbc0
_compound_head include/linux/page-flags.h:272 [inline]
PageAnon include/linux/page-flags.h:670 [inline]
mm_counter include/linux/mm.h:2047 [inline]
zap_pte_range mm/memory.c:1445 [inline]
zap_pmd_range mm/memory.c:1567 [inline]
zap_pud_range mm/memory.c:1596 [inline]
zap_p4d_range mm/memory.c:1617 [inline]
unmap_page_range+0xf3e/0x3710 mm/memory.c:1638
unmap_single_vma+0x196/0x360 mm/memory.c:1686
unmap_vmas+0x18c/0x310 mm/memory.c:1723
exit_mmap+0x1c4/0x4a0 mm/mmap.c:3162
__mmput+0x122/0x4b0 kernel/fork.c:1187
mmput+0x56/0x60 kernel/fork.c:1208
exit_mm kernel/exit.c:510 [inline]
do_exit+0xa12/0x2a00 kernel/exit.c:782
do_group_exit+0xd2/0x2f0 kernel/exit.c:925
__do_sys_exit_group kernel/exit.c:936 [inline]
__se_sys_exit_group kernel/exit.c:934 [inline]
__x64_sys_exit_group+0x3a/0x50 kernel/exit.c:934
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+0x46/0xb0
RIP: 0033:0x7f4ce927d309
Code: Unable to access opcode bytes at RIP 0x7f4ce927d2df.
RSP: 002b:00007ffdbe67d428 EFLAGS: 00000202 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 000055ec2044ae04 RCX: 00007f4ce927d309
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000
RBP: 0000000000000003 R08: ffffffffffffff88 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 000055ec1fa27070
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
Allocated by task 3713:
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+0x90/0xc0 mm/kasan/common.c:469
kasan_slab_alloc include/linux/kasan.h:224 [inline]
slab_post_alloc_hook mm/slab.h:750 [inline]
slab_alloc_node mm/slub.c:3214 [inline]
slab_alloc mm/slub.c:3222 [inline]
__kmem_cache_alloc_lru mm/slub.c:3229 [inline]
kmem_cache_alloc+0x204/0x3b0 mm/slub.c:3239
vm_area_dup+0x88/0x3f0 kernel/fork.c:467
dup_mmap kernel/fork.c:641 [inline]
dup_mm+0x5fa/0x1390 kernel/fork.c:1524
copy_mm kernel/fork.c:1576 [inline]
copy_process+0x3b1c/0x6ff0 kernel/fork.c:2237
kernel_clone+0xe7/0xab0 kernel/fork.c:2642
__do_sys_clone+0xc8/0x110 kernel/fork.c:2759
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+0x46/0xb0
Freed by task 4792:
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+0x166/0x1a0 mm/kasan/common.c:328
kasan_slab_free include/linux/kasan.h:200 [inline]
slab_free_hook mm/slub.c:1727 [inline]
slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1753
slab_free mm/slub.c:3507 [inline]
kmem_cache_free+0xdd/0x5a0 mm/slub.c:3524
remove_vma+0x135/0x170 mm/mmap.c:194
exit_mmap+0x259/0x4a0 mm/mmap.c:3170
__mmput+0x122/0x4b0 kernel/fork.c:1187
mmput+0x56/0x60 kernel/fork.c:1208
exit_mm kernel/exit.c:510 [inline]
do_exit+0xa12/0x2a00 kernel/exit.c:782
do_group_exit+0xd2/0x2f0 kernel/exit.c:925
get_signal+0x22df/0x24c0 kernel/signal.c:2875
arch_do_signal_or_restart+0x82/0x20f0 arch/x86/kernel/signal.c:869
exit_to_user_mode_loop kernel/entry/common.c:166 [inline]
exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:201
__syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline]
syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294
do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x46/0xb0
The buggy address belongs to the object at ffff888020ca4000
which belongs to the cache vm_area_struct of size 200
The buggy address is located 45 bytes inside of
200-byte region [ffff888020ca4000, ffff888020ca40c8)
The buggy address belongs to the physical page:
page:ffffea0000832900 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x20ca4
memcg:ffff8880729e4001
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 dead000000000100 dead000000000122 ffff888140006a00
raw: 0000000000000000 00000000000f000f 00000001ffffffff ffff8880729e4001
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 4567, tgid 4567 (rm), ts 114683150701, free_ts 114678525675
prep_new_page mm/page_alloc.c:2456 [inline]
get_page_from_freelist+0x1290/0x3b70 mm/page_alloc.c:4198
__alloc_pages+0x1c7/0x510 mm/page_alloc.c:5426
alloc_pages+0x1aa/0x310 mm/mempolicy.c:2272
alloc_slab_page mm/slub.c:1797 [inline]
allocate_slab+0x26c/0x3c0 mm/slub.c:1942
new_slab mm/slub.c:2002 [inline]
___slab_alloc+0x985/0xd90 mm/slub.c:3002
__slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3089
slab_alloc_node mm/slub.c:3180 [inline]
slab_alloc mm/slub.c:3222 [inline]
__kmem_cache_alloc_lru mm/slub.c:3229 [inline]
kmem_cache_alloc+0x360/0x3b0 mm/slub.c:3239
vm_area_alloc+0x1c/0x110 kernel/fork.c:459
mmap_region+0x96e/0x1460 mm/mmap.c:1776
do_mmap+0x863/0xfa0 mm/mmap.c:1587
vm_mmap_pgoff+0x1b7/0x290 mm/util.c:552
ksys_mmap_pgoff+0x40d/0x5a0 mm/mmap.c:1633
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+0x46/0xb0
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1371 [inline]
free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1421
free_unref_page_prepare mm/page_alloc.c:3343 [inline]
free_unref_page_list+0x16f/0xf80 mm/page_alloc.c:3475
release_pages+0xff1/0x2290 mm/swap.c:980
tlb_batch_pages_flush+0xa8/0x1a0 mm/mmu_gather.c:58
tlb_flush_mmu_free mm/mmu_gather.c:255 [inline]
tlb_flush_mmu mm/mmu_gather.c:262 [inline]
tlb_finish_mmu+0x147/0x7e0 mm/mmu_gather.c:353
exit_mmap+0x1de/0x4a0 mm/mmap.c:3164
__mmput+0x122/0x4b0 kernel/fork.c:1187
mmput+0x56/0x60 kernel/fork.c:1208
exec_mmap fs/exec.c:1038 [inline]
begin_new_exec+0x101b/0x2f70 fs/exec.c:1297
load_elf_binary+0x15a3/0x4ec0 fs/binfmt_elf.c:1002
search_binary_handler fs/exec.c:1730 [inline]
exec_binprm fs/exec.c:1771 [inline]
bprm_execve fs/exec.c:1840 [inline]
bprm_execve+0x7ef/0x1970 fs/exec.c:1802
do_execveat_common+0x727/0x890 fs/exec.c:1945
do_execve fs/exec.c:2015 [inline]
__do_sys_execve fs/exec.c:2091 [inline]
__se_sys_execve fs/exec.c:2086 [inline]
__x64_sys_execve+0x8f/0xc0 fs/exec.c:2086
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+0x46/0xb0
Memory state around the buggy address:
ffff888020ca3f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888020ca3f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888020ca4000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888020ca4080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
ffff888020ca4100: fc fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: 48 89 ef mov %rbp,%rdi
3: 5d pop %rbp
4: e9 31 1e 4c 00 jmpq 0x4c1e3a
9: 5d pop %rbp
a: be 03 00 00 00 mov $0x3,%esi
f: e9 46 9d 81 02 jmpq 0x2819d5a
14: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1)
1a: 48 8b be a8 01 00 00 mov 0x1a8(%rsi),%rdi
21: e8 b4 ff ff ff callq 0xffffffda
26: 31 c0 xor %eax,%eax
28: c3 retq
29: 90 nop
* 2a: 65 8b 05 e9 ea 87 7e mov %gs:0x7e87eae9(%rip),%eax # 0x7e87eb1a <-- trapping instruction
31: 89 c1 mov %eax,%ecx
33: 48 8b 34 24 mov (%rsp),%rsi
37: 81 e1 00 01 00 00 and $0x100,%ecx
3d: 65 gs
3e: 48 rex.W
3f: 8b .byte 0x8b