==================================================================
BUG: KASAN: stack-out-of-bounds in bpf_net_ctx_get_all_used_flush_lists include/linux/filter.h:837 [inline]
BUG: KASAN: stack-out-of-bounds in xdp_do_check_flushed+0x231/0x240 net/core/filter.c:4305
Read of size 4 at addr ffffc900044277f8 by task syz.0.2259/14171
CPU: 1 UID: 0 PID: 14171 Comm: syz.0.2259 Not tainted 6.11.0-rc1-syzkaller-00004-gdc1c8034e31b #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024
Call Trace:
__dump_stack lib/dump_stack.c:93 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
print_address_description mm/kasan/report.c:377 [inline]
print_report+0x169/0x550 mm/kasan/report.c:488
kasan_report+0x143/0x180 mm/kasan/report.c:601
bpf_net_ctx_get_all_used_flush_lists include/linux/filter.h:837 [inline]
xdp_do_check_flushed+0x231/0x240 net/core/filter.c:4305
__napi_poll+0xe4/0x490 net/core/dev.c:6774
napi_poll net/core/dev.c:6840 [inline]
net_rx_action+0x89b/0x1240 net/core/dev.c:6962
handle_softirqs+0x2c4/0x970 kernel/softirq.c:554
__do_softirq kernel/softirq.c:588 [inline]
invoke_softirq kernel/softirq.c:428 [inline]
__irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637
irq_exit_rcu+0x9/0x30 kernel/softirq.c:649
common_interrupt+0xaa/0xd0 arch/x86/kernel/irq.c:278
asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693
RIP: 0010:_compound_head include/linux/page-flags.h:242 [inline]
RIP: 0010:virt_to_folio include/linux/mm.h:1292 [inline]
RIP: 0010:kfree+0x8b/0x360 mm/slub.c:4586
Code: fb 11 0f 82 20 01 00 00 48 89 df e8 7f e2 56 ff 49 89 c7 49 c1 ef 06 49 83 e7 c0 48 b9 00 00 00 00 00 ea ff ff 49 8b 44 0f 08 01 0f 85 6e 02 00 00 49 01 cf 0f 1f 44 00 00 b8 00 00 00 82 41
RSP: 0018:ffffc90004427038 EFLAGS: 00000206
RAX: ffffea00019a5a01 RBX: ffff88806696f000 RCX: ffffea0000000000
RDX: ffffc90011f08000 RSI: 000000000003ffff RDI: 0000000000040000
RBP: 1ffff110050d1280 R08: ffffffff8142a2ec R09: 1ffffffff1feced5
R10: dffffc0000000000 R11: fffffbfff1feced6 R12: 1ffff110050d128a
R13: 0000000000000000 R14: ffffffff81a97c9e R15: 00000000019a5bc0
free_func_state kernel/bpf/verifier.c:1376 [inline]
free_verifier_state+0xde/0x240 kernel/bpf/verifier.c:1392
free_states kernel/bpf/verifier.c:20782 [inline]
do_check_common+0x16e6/0x1dd0 kernel/bpf/verifier.c:20927
do_check_main kernel/bpf/verifier.c:21006 [inline]
bpf_check+0x1453f/0x196a0 kernel/bpf/verifier.c:21680
bpf_prog_load+0x1667/0x20f0 kernel/bpf/syscall.c:2908
__sys_bpf+0x4ee/0x810 kernel/bpf/syscall.c:5710
__do_sys_bpf kernel/bpf/syscall.c:5817 [inline]
__se_sys_bpf kernel/bpf/syscall.c:5815 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5815
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7efdc7f77299
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:00007efdc8cf5048 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007efdc8105f80 RCX: 00007efdc7f77299
RDX: 0000000000000090 RSI: 0000000020000840 RDI: 0000000000000005
RBP: 00007efdc7fe48e6 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007efdc8105f80 R15: 00007ffd4d784ca8
The buggy address belongs to stack of task syz.0.2259/14171
and is located at offset 664 in frame:
bpf_check+0x0/0x196a0 kernel/bpf/verifier.c:21563
This frame has 22 objects:
[32, 36) 'off.addr.i1017.i.i'
[48, 52) 'off.addr.i.i.i870'
[64, 80) 'zext_patch.i'
[96, 128) 'rnd_hi32_patch.i'
[160, 208) 'desc.i.i.i739'
[240, 368) 'insn_buf.i740'
[400, 424) 'patch.i741'
[464, 496) 'chk_and_div.i'
[528, 560) 'chk_and_mod.i'
[592, 648) 'desc.i'
[688, 816) 'insn_buf.i'
[848, 852) 'target_size.i'
[864, 880) 'patch.i'
[896, 904) 'ja.i'
[928, 1080) 'insn_buf.i.i'
[1152, 1156) 'off.addr.i.i.i'
[1168, 1200) 'ret_insn.i.i'
[1232, 1264) 'ret_prog.i.i'
[1296, 1344) 'desc.i.i.i'
[1376, 1384) 'addr.i.i'
[1408, 1412) 'min_size.i.i'
[1424, 1428) 'log_true_size'
The buggy address belongs to the virtual mapping at
[ffffc90004420000, ffffc90004429000) created by:
copy_process+0x5d1/0x3dc0 kernel/fork.c:2204
The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x4 pfn:0x7c399
memcg:ffff88801f13d102
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000004 0000000000000000 00000001ffffffff ffff88801f13d102
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x102dc2(GFP_HIGHUSER|__GFP_NOWARN|__GFP_ZERO), pid 14158, tgid 14158 (syz.3.2257), ts 899417882287, free_ts 896366998289
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1493
prep_new_page mm/page_alloc.c:1501 [inline]
get_page_from_freelist+0x2e4c/0x2f10 mm/page_alloc.c:3442
__alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4700
alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2263
vm_area_alloc_pages mm/vmalloc.c:3584 [inline]
__vmalloc_area_node mm/vmalloc.c:3660 [inline]
__vmalloc_node_range_noprof+0x971/0x1460 mm/vmalloc.c:3841
alloc_thread_stack_node kernel/fork.c:313 [inline]
dup_task_struct+0x444/0x8c0 kernel/fork.c:1113
copy_process+0x5d1/0x3dc0 kernel/fork.c:2204
kernel_clone+0x223/0x870 kernel/fork.c:2781
__do_sys_clone3 kernel/fork.c:3085 [inline]
__se_sys_clone3+0x2cb/0x350 kernel/fork.c:3064
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 14118 tgid 14118 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1094 [inline]
free_unref_page+0xd19/0xea0 mm/page_alloc.c:2612
vfree+0x186/0x2e0 mm/vmalloc.c:3364
vb2_vmalloc_put+0x68/0xb0 drivers/media/common/videobuf2/videobuf2-vmalloc.c:68
__vb2_buf_mem_free+0xfa/0x2a0 drivers/media/common/videobuf2/videobuf2-core.c:275
__vb2_free_mem drivers/media/common/videobuf2/videobuf2-core.c:557 [inline]
__vb2_queue_free+0x450/0xed0 drivers/media/common/videobuf2/videobuf2-core.c:585
vb2_core_queue_release+0x6c/0x150 drivers/media/common/videobuf2/videobuf2-core.c:2654
v4l2_m2m_ctx_release+0x1e/0x40 drivers/media/v4l2-core/v4l2-mem2mem.c:1276
vicodec_release+0x97/0x110 drivers/media/test-drivers/vicodec/vicodec-core.c:1941
v4l2_release+0x1f8/0x3b0 drivers/media/v4l2-core/v4l2-dev.c:456
__fput+0x24a/0x8a0 fs/file_table.c:422
task_work_run+0x24f/0x310 kernel/task_work.c:222
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
exit_to_user_mode_loop kernel/entry/common.c:114 [inline]
exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
__syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
syscall_exit_to_user_mode+0x168/0x370 kernel/entry/common.c:218
do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffffc90004427680: 00 00 00 00 00 00 00 00 00 00 f2 f2 f2 f2 00 00
ffffc90004427700: 00 f2 f2 f2 f2 f2 00 00 00 00 f2 f2 f2 f2 00 00
>ffffc90004427780: 00 00 f2 f2 f2 f2 00 00 00 00 00 00 00 f2 f2 f2
^
ffffc90004427800: f2 f2 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffffc90004427880: 00 00 f2 f2 f2 f2 04 f2 00 00 f2 f2 00 f2 f2 f2
==================================================================
----------------
Code disassembly (best guess), 2 bytes skipped:
0: 0f 82 20 01 00 00 jb 0x126
6: 48 89 df mov %rbx,%rdi
9: e8 7f e2 56 ff call 0xff56e28d
e: 49 89 c7 mov %rax,%r15
11: 49 c1 ef 06 shr $0x6,%r15
15: 49 83 e7 c0 and $0xffffffffffffffc0,%r15
19: 48 b9 00 00 00 00 00 movabs $0xffffea0000000000,%rcx
20: ea ff ff
23: 49 8b 44 0f 08 mov 0x8(%r15,%rcx,1),%rax
* 28: a8 01 test $0x1,%al <-- trapping instruction
2a: 0f 85 6e 02 00 00 jne 0x29e
30: 49 01 cf add %rcx,%r15
33: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
38: b8 00 00 00 82 mov $0x82000000,%eax
3d: 41 rex.B