==================================================================
BUG: KASAN: use-after-free in decode_session6+0x10e1/0x1950 net/xfrm/xfrm_policy.c:3460
Read of size 1 at addr ffff88806678ab9c by task syz-executor.5/32650
CPU: 1 PID: 32650 Comm: syz-executor.5 Not tainted 6.5.0-rc5-syzkaller-00243-g9106536c1aa3 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:364 [inline]
print_report+0xc4/0x620 mm/kasan/report.c:475
kasan_report+0xda/0x110 mm/kasan/report.c:588
decode_session6+0x10e1/0x1950 net/xfrm/xfrm_policy.c:3460
__xfrm_decode_session+0x54/0xb0 net/xfrm/xfrm_policy.c:3566
xfrm_decode_session include/net/xfrm.h:1216 [inline]
xfrmi_xmit+0x17c/0x1ca0 net/xfrm/xfrm_interface_core.c:540
__netdev_start_xmit include/linux/netdevice.h:4910 [inline]
netdev_start_xmit include/linux/netdevice.h:4924 [inline]
xmit_one net/core/dev.c:3537 [inline]
dev_hard_start_xmit+0x13d/0x6c0 net/core/dev.c:3553
sch_direct_xmit+0x1ac/0xc20 net/sched/sch_generic.c:342
qdisc_restart net/sched/sch_generic.c:407 [inline]
__qdisc_run+0x540/0x19d0 net/sched/sch_generic.c:415
__dev_xmit_skb net/core/dev.c:3827 [inline]
__dev_queue_xmit+0x26ab/0x3f20 net/core/dev.c:4169
dev_queue_xmit include/linux/netdevice.h:3088 [inline]
neigh_connected_output+0x42c/0x5d0 net/core/neighbour.c:1581
neigh_output include/net/neighbour.h:544 [inline]
ip6_finish_output2+0x5d0/0x1b20 net/ipv6/ip6_output.c:135
__ip6_finish_output net/ipv6/ip6_output.c:196 [inline]
ip6_finish_output+0x485/0x11d0 net/ipv6/ip6_output.c:207
NF_HOOK_COND include/linux/netfilter.h:292 [inline]
ip6_output+0x243/0x890 net/ipv6/ip6_output.c:228
dst_output include/net/dst.h:458 [inline]
NF_HOOK.constprop.0+0xfd/0x540 include/linux/netfilter.h:303
ndisc_send_skb+0x9e8/0x1430 net/ipv6/ndisc.c:509
ndisc_send_rs+0x133/0x690 net/ipv6/ndisc.c:719
addrconf_rs_timer+0x412/0x840 net/ipv6/addrconf.c:3941
call_timer_fn+0x1a0/0x580 kernel/time/timer.c:1700
expire_timers kernel/time/timer.c:1751 [inline]
__run_timers+0x764/0xb10 kernel/time/timer.c:2022
run_timer_softirq+0x58/0xd0 kernel/time/timer.c:2035
__do_softirq+0x218/0x965 kernel/softirq.c:553
invoke_softirq kernel/softirq.c:427 [inline]
__irq_exit_rcu kernel/softirq.c:632 [inline]
irq_exit_rcu+0xb7/0x120 kernel/softirq.c:644
sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1109
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645
RIP: 0010:__sanitizer_cov_trace_const_cmp4+0x0/0x20 kernel/kcov.c:303
Code: d6 fe ff ff 66 0f 1f 44 00 00 f3 0f 1e fa 48 8b 0c 24 0f b7 d6 0f b7 f7 bf 03 00 00 00 e9 b8 fe ff ff 0f 1f 84 00 00 00 00 00 0f 1e fa 48 8b 0c 24 89 f2 89 fe bf 05 00 00 00 e9 9a fe ff ff
RSP: 0018:ffffc900078ff8f8 EFLAGS: 00000246
RAX: 0000000000000000 RBX: 0000000000000009 RCX: 0000000000000000
RDX: ffff888032bc9dc0 RSI: 0000000000000009 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000007 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000094000 R12: 00007f2c66ea6000
R13: ffff88802a058528 R14: dffffc0000000000 R15: ffffea0001281100
zap_pte_range mm/memory.c:1454 [inline]
zap_pmd_range mm/memory.c:1570 [inline]
zap_pud_range mm/memory.c:1599 [inline]
zap_p4d_range mm/memory.c:1620 [inline]
unmap_page_range+0x201e/0x32e0 mm/memory.c:1641
unmap_single_vma+0x194/0x2b0 mm/memory.c:1687
unmap_vmas+0x267/0x3c0 mm/memory.c:1726
exit_mmap+0x1a7/0x960 mm/mmap.c:3203
__mmput+0x12a/0x4d0 kernel/fork.c:1348
mmput+0x62/0x70 kernel/fork.c:1370
exit_mm kernel/exit.c:567 [inline]
do_exit+0x9b4/0x2a20 kernel/exit.c:861
do_group_exit+0xd4/0x2a0 kernel/exit.c:1024
__do_sys_exit_group kernel/exit.c:1035 [inline]
__se_sys_exit_group kernel/exit.c:1033 [inline]
__x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1033
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f2c6767cae9
Code: Unable to access opcode bytes at 0x7f2c6767cabf.
RSP: 002b:00007f2c678bfd38 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 000000000000001e RCX: 00007f2c6767cae9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000000
R10: 0000001b2fe60000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000001 R15: 0000000000000000
The buggy address belongs to the physical page:
page:ffffea000199e280 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x6678a
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000000 dead000000000100 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x102dc2(GFP_HIGHUSER|__GFP_NOWARN|__GFP_ZERO), pid 31991, tgid 31975 (syz-executor.0), ts 2094368529071, free_ts 2094714318313
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x2d2/0x350 mm/page_alloc.c:1570
prep_new_page mm/page_alloc.c:1577 [inline]
get_page_from_freelist+0x10a9/0x31e0 mm/page_alloc.c:3221
__alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4477
alloc_pages+0x1a9/0x270 mm/mempolicy.c:2292
vm_area_alloc_pages mm/vmalloc.c:3059 [inline]
__vmalloc_area_node mm/vmalloc.c:3135 [inline]
__vmalloc_node_range+0xa6e/0x1540 mm/vmalloc.c:3316
vmalloc_user+0x6b/0x80 mm/vmalloc.c:3470
vb2_vmalloc_alloc+0x11e/0x3d0 drivers/media/common/videobuf2/videobuf2-vmalloc.c:48
__vb2_buf_mem_alloc drivers/media/common/videobuf2/videobuf2-core.c:233 [inline]
__vb2_queue_alloc+0x6a9/0x12a0 drivers/media/common/videobuf2/videobuf2-core.c:444
vb2_core_reqbufs+0x8ce/0xec0 drivers/media/common/videobuf2/videobuf2-core.c:834
vb2_reqbufs+0x1a8/0x1f0 drivers/media/common/videobuf2/videobuf2-v4l2.c:718
v4l2_m2m_reqbufs drivers/media/v4l2-core/v4l2-mem2mem.c:579 [inline]
v4l2_m2m_ioctl_reqbufs+0xe2/0x1f0 drivers/media/v4l2-core/v4l2-mem2mem.c:1367
v4l_reqbufs+0xa4/0xd0 drivers/media/v4l2-core/v4l2-ioctl.c:2100
__video_do_ioctl+0xaea/0xef0 drivers/media/v4l2-core/v4l2-ioctl.c:3046
video_usercopy+0x4c2/0x15c0 drivers/media/v4l2-core/v4l2-ioctl.c:3387
v4l2_ioctl+0x1bd/0x250 drivers/media/v4l2-core/v4l2-dev.c:364
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__x64_sys_ioctl+0x18f/0x210 fs/ioctl.c:856
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1161 [inline]
free_unref_page_prepare+0x508/0xb90 mm/page_alloc.c:2348
free_unref_page+0x33/0x3b0 mm/page_alloc.c:2443
vfree+0x181/0x7a0 mm/vmalloc.c:2842
vb2_vmalloc_put drivers/media/common/videobuf2/videobuf2-vmalloc.c:69 [inline]
vb2_vmalloc_put+0x8e/0xd0 drivers/media/common/videobuf2/videobuf2-vmalloc.c:64
__vb2_buf_mem_free+0x154/0x2c0 drivers/media/common/videobuf2/videobuf2-core.c:266
__vb2_free_mem drivers/media/common/videobuf2/videobuf2-core.c:492 [inline]
__vb2_queue_free+0x6ea/0x940 drivers/media/common/videobuf2/videobuf2-core.c:521
vb2_core_queue_release+0x61/0x80 drivers/media/common/videobuf2/videobuf2-core.c:2471
v4l2_m2m_ctx_release+0x2a/0x40 drivers/media/v4l2-core/v4l2-mem2mem.c:1268
vim2m_release+0xe4/0x170 drivers/media/test-drivers/vim2m.c:1245
v4l2_release+0x236/0x450 drivers/media/v4l2-core/v4l2-dev.c:456
__fput+0x3f7/0xac0 fs/file_table.c:384
task_work_run+0x14d/0x240 kernel/task_work.c:179
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204
__syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297
do_syscall_64+0x44/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Memory state around the buggy address:
ffff88806678aa80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88806678ab00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88806678ab80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff88806678ac00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88806678ac80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================
----------------
Code disassembly (best guess), 4 bytes skipped:
0: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1)
6: f3 0f 1e fa endbr64
a: 48 8b 0c 24 mov (%rsp),%rcx
e: 0f b7 d6 movzwl %si,%edx
11: 0f b7 f7 movzwl %di,%esi
14: bf 03 00 00 00 mov $0x3,%edi
19: e9 b8 fe ff ff jmp 0xfffffed6
1e: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1)
25: 00
* 26: f3 0f 1e fa endbr64 <-- trapping instruction
2a: 48 8b 0c 24 mov (%rsp),%rcx
2e: 89 f2 mov %esi,%edx
30: 89 fe mov %edi,%esi
32: bf 05 00 00 00 mov $0x5,%edi
37: e9 9a fe ff ff jmp 0xfffffed6