CVE-2026-139202

bpf: Validate stack arg reads against caller state

Published Nov 30, 2026 CVSS n/a EPSS n/a KEV · Not listed
Description
In the Linux kernel, the following vulnerability has been resolved:

bpf: Validate stack arg reads against caller state

check_stack_arg_read() bounds a stack argument index with the callee's
BTF-derived argument count, then uses the index in the caller's
stack_arg_regs[] array. The array's actual logical length is recorded in
caller->out_stack_arg_cnt, so the bound and indexed object can diverge.

A crafted BPF_PROG_LOAD can use an argument mismatch to mark a static
subprogram's BTF information unreliable. Later calls return from
btf_check_subprog_call() before check_outgoing_stack_args(), while
check_func_call() continues the static call on -EINVAL. The callee can
then read a slot that the caller never allocated or initialized. The
earlier commit 4286f5deee14 ("bpf: Validate outgoing stack args when
btf_prepare_func_args fails") closed this hole for the first call, but
not for later calls after the subprogram has been marked unreliable.

Callbacks have a related problem. The verifier can make incoming stack
arguments readable from outgoing slots at the helper call site. However,
helpers and kfuncs invoke callbacks through an ABI that passes at most five
arguments, so the runtime callback receives no stack arguments. Async
callback verification can also reach check_stack_arg_read() without a
caller frame.

On x86-64, KASAN reports the direct-call out-of-bounds copy as:

BUG: KASAN: slab-out-of-bounds in check_load_mem+0xb51/0xc60
Read of size 80 at addr ffff8881009af550 by task poc/131
Call Trace:
check_stack_arg_read at kernel/bpf/verifier.c:4234
(inlined by) check_load_mem at kernel/bpf/verifier.c:6645
do_check_common at kernel/bpf/verifier.c:19568
bpf_check at kernel/bpf/verifier.c:21318
bpf_prog_load at kernel/bpf/syscall.c:3134

Reject callback subprograms with incoming stack arguments before their
state is pushed. For direct calls, retrieve the slot with
bpf_get_spilled_stack_arg(), which validates the index against the caller's
out_stack_arg_cnt and rejects uninitialized slots before copying the
register state.

Analysis

AI-generated

Technical impact

A flaw in the BPF verifier allows a crafted BPF program to read from an uninitialized or out‑of‑bounds stack slot of the caller. The verifier bounds the argument index with the callee’s BTF‑derived count but then indexes into the caller’s stack_arg_regs array without verifying the index against the caller’s actual out_stack_arg_cnt, enabling an attacker to read memory that was never allocated or initialized. The read can expose sensitive kernel data or trigger a kernel panic through later misuse of the value.

Affected Systems

All Linux kernel releases that include the affected BPF verifier logic are impacted. The description indicates the bug is present in core kernel code, so any installed kernel that supports BPF until the patches are applied is at risk. No specific vendor or version list is provided, so administrators should treat all current and older kernels as potentially exposed until a correct kernel is installed.

Risk and Exploitability

The flaw has a high potential impact because it permits an unprivileged user to inject a custom BPF program via the bpf() system call, causing the kernel to read arbitrary memory locations. The CVSS score is not available in the data, but the out‑of‑bounds read suggests a security‑sensitive issue that could lead to information disclosure. No EPSS score is provided and the vulnerability is not listed in KEV, but the lack of exploitation data does not reduce the urgency of applying the fix.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Install a Linux kernel that incorporates the fix for the BPF stack argument check bug (commit 4286f5deee14 or later).
  • If a kernel update is not immediately possible, limit the use of BPF by restricting the bpf() syscall to privileged users or disabling BPF entirely in the kernel configuration.
  • Validate your BPF programs by ensuring they do not request more stack arguments than allowed and that the BTF information matches the actual stack layout before loading; run static analysis or use the latest verifiers.

Generated by OpenCVE AI on November 30, 2026 at 20:17 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Weaknesses CWE-119
Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: bpf: Validate stack arg reads against caller state check_stack_arg_read() bounds a stack argument index with the callee's BTF-derived argument count, then uses the index in the caller's stack_arg_regs[] array. The array's actual logical length is recorded in caller->out_stack_arg_cnt, so the bound and indexed object can diverge. A crafted BPF_PROG_LOAD can use an argument mismatch to mark a static subprogram's BTF information unreliable. Later calls return from btf_check_subprog_call() before check_outgoing_stack_args(), while check_func_call() continues the static call on -EINVAL. The callee can then read a slot that the caller never allocated or initialized. The earlier commit 4286f5deee14 ("bpf: Validate outgoing stack args when btf_prepare_func_args fails") closed this hole for the first call, but not for later calls after the subprogram has been marked unreliable. Callbacks have a related problem. The verifier can make incoming stack arguments readable from outgoing slots at the helper call site. However, helpers and kfuncs invoke callbacks through an ABI that passes at most five arguments, so the runtime callback receives no stack arguments. Async callback verification can also reach check_stack_arg_read() without a caller frame. On x86-64, KASAN reports the direct-call out-of-bounds copy as: BUG: KASAN: slab-out-of-bounds in check_load_mem+0xb51/0xc60 Read of size 80 at addr ffff8881009af550 by task poc/131 Call Trace: check_stack_arg_read at kernel/bpf/verifier.c:4234 (inlined by) check_load_mem at kernel/bpf/verifier.c:6645 do_check_common at kernel/bpf/verifier.c:19568 bpf_check at kernel/bpf/verifier.c:21318 bpf_prog_load at kernel/bpf/syscall.c:3134 Reject callback subprograms with incoming stack arguments before their state is pushed. For direct calls, retrieve the slot with bpf_get_spilled_stack_arg(), which validates the index against the caller's out_stack_arg_cnt and rejects uninitialized slots before copying the register state.
Title bpf: Validate stack arg reads against caller state
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References
Weaknesses
  • CWE-119

    Improper Restriction of Operations within the Bounds of a Memory Buffer

Sources

Status
PUBLISHED
Assigner
Linux
Published
Updated
Nov 30, 2026, 1:32 PM
Reserved
Nov 30, 2026, 1:22 PM
Status
Received
Published
Nov 30, 2026, 2:18 PM
Modified
Nov 30, 2026, 2:18 PM