# CVE-2026-139629: bpf: Check fastcall stack contract once for all stack accesses

- **Severity:** UNSCORED
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Unknown
- **Published:** 2026-11-30T13:36:31.012Z
- **Modified:** 2026-11-30T14:19:45.970Z

> **AI summary (AI-generated, claude-haiku-5-5):** A local attacker with limited BPF privileges can make the Linux kernel verifier accept programs whose helper or callee stack accesses read kernel stack memory outside the program frame.

## Who should check

- Anyone running Linux \>= 5b5f51bff1b66cedb62b5ba74a1878341204e057, \< 6acd70ced460317eb8d0dd8b5907b65292c59a42; \>= 5b5f51bff1b66cedb62b5ba74a1878341204e057, \< 31594d4872dfdbad767e67fcc74bcd0a31f02150; \>= 5b5f51bff1b66cedb62b5ba74a1878341204e057, \< f19a6264a62b910332a61523177b3cccf4bab46d; \>= 5b5f51bff1b66cedb62b5ba74a1878341204e057, \< ec3a69e7c021cd826be8886ba6af4ee3147788fb
- Anyone running Linux 6.12

## Description

In the Linux kernel, the following vulnerability has been resolved:

bpf: Check fastcall stack contract once for all stack accesses

When the verifier inlines a bpf\_fastcall helper or kfunc, it removes the
spill/fill pairs that clang emitted around the call and lowers the
subprogram's stack depth so that their slots are no longer part of the
frame. This is only safe if nothing else accesses those slots or any slot
below them. check\_fastcall\_stack\_contract() enforces this: an access to
that region from outside a fastcall pattern disables the rewrite for the
subprogram. It is called from the four stack load and store paths, and
two kinds of access escape it.

Stack buffers passed to helpers and kfuncs are validated by
check\_stack\_range\_initialized(), which does not call it. If such a buffer
is the only other access to the region, the rewrite is still applied, the
JIT reserves a frame that does not contain the buffer, and the helper
reads or writes live kernel stack below the program's frame. For example,
without CAP\_PERFMON:

	\*(u64 \*)(r10 - 8) = r1;
	call bpf\_get\_smp\_processor\_id;
	r1 = \*(u64 \*)(r10 - 8);
	r2 = 0;
	r3 = r10;
	r3 += -64;
	r4 = 8;
	call bpf\_skb\_load\_bytes;

is accepted with a stack depth of 0 instead of 64.

Some buffers got the check indirectly. For constant-sized outputs in raw
mode, mark\_raw\_stack() marks the buffer initialized through ordinary
byte stores, which call the check. Commit 5da4a9f26fca ("bpf: Preserve
stack initialization for generic output buffers") limited raw mode to
programs that may read uninitialized stack, so outputs of programs
without CAP\_PERFMON lost the check, as in the example above. Buffers
that never used raw mode have lacked the check since fastcall support
was added: helper inputs such as a map key whose only store is a fastcall
spill, variable-sized outputs, and buffers at a variable stack offset.

check\_stack\_read\_fixed\_off() applies the check to the current frame,
even when the pointer targets a caller's stack. A callee can therefore
read a caller's fastcall spill slot without disabling the caller's
rewrite:

	caller:
	r1 = 1;
	\*(u64 \*)(r10 - 8) = r1;
	call bpf\_get\_smp\_processor\_id;
	r1 = \*(u64 \*)(r10 - 8);
	r1 = r10;
	r1 += -8;
	call callee;

	callee:
	r0 = \*(u64 \*)(r1 + 0);

The caller's spill and fill are removed and its stack depth drops to 0,
but the verifier still tracks the slot as holding the spilled constant.
The callee's load then reads kernel stack outside the caller's frame,
while the verifier assumes r0 is 1.

Every stack access first goes through check\_stack\_access\_within\_bounds():
loads and stores from check\_mem\_access(), helper and kfunc buffers from
check\_stack\_range\_initialized(), and the dynptr, iterator and irq flag
slots that kfuncs initialize, whose handlers use check\_mem\_access(). It
resolves the frame that owns the slots and the lowest offset the access
can touch, and it is the only place where a frame's stack depth grows.
Check the contract there, once for every access, and drop the calls from
the stack read and write paths. Zero-sized buffers touch no stack and
leave the rewrite enabled.

## Affected and fixed versions

- Linux: \>= 5b5f51bff1b66cedb62b5ba74a1878341204e057, \< 6acd70ced460317eb8d0dd8b5907b65292c59a42; \>= 5b5f51bff1b66cedb62b5ba74a1878341204e057, \< 31594d4872dfdbad767e67fcc74bcd0a31f02150; \>= 5b5f51bff1b66cedb62b5ba74a1878341204e057, \< f19a6264a62b910332a61523177b3cccf4bab46d; \>= 5b5f51bff1b66cedb62b5ba74a1878341204e057, \< ec3a69e7c021cd826be8886ba6af4ee3147788fb (cvelist)
- Linux: 6.12 (cvelist)

## Technologies

Linux kernel

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-139629. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-139629.md
Affected: Linux >= 5b5f51bff1b66cedb62b5ba74a1878341204e057, < 6acd70ced460317eb8d0dd8b5907b65292c59a42; >= 5b5f51bff1b66cedb62b5ba74a1878341204e057, < 31594d4872dfdbad767e67fcc74bcd0a31f02150; >= 5b5f51bff1b66cedb62b5ba74a1878341204e057, < f19a6264a62b910332a61523177b3cccf4bab46d; >= 5b5f51bff1b66cedb62b5ba…
Fixed in: Linux 6acd70ced460317eb8d0dd8b5907b65292c59a42, Linux 31594d4872dfdbad767e67fcc74bcd0a31f02150

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-139629 being exploited?

There is no confirmed exploitation: CVE-2026-139629 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known.

### How serious is CVE-2026-139629?

It has no CVSS score yet. Unknown.

### Which versions are affected by CVE-2026-139629?

Linux \>= 5b5f51bff1b66cedb62b5ba74a1878341204e057, \< 6acd70ced460317eb8d0dd8b5907b65292c59a42; \>= 5b5f51bff1b66cedb62b5ba74a1878341204e057, \< 31594d4872dfdbad767e67fcc74bcd0a31f02150; \>= 5b5f51bff1b66cedb62b5ba74a1878341204e057, \< f19a6264a62b910332a61523177b3cccf4bab46d; \>= 5b5f51bff1b66cedb62b5ba74a1878341204e057, \< ec3a69e7c021cd826be8886ba6af4ee3147788fb; Linux 6.12.

### Is there a fix for CVE-2026-139629?

Yes. Fixed in Linux 6acd70ced460317eb8d0dd8b5907b65292c59a42, Linux 31594d4872dfdbad767e67fcc74bcd0a31f02150. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2026-139629?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- other: <https://git.kernel.org/stable/c/6acd70ced460317eb8d0dd8b5907b65292c59a42>
- other: <https://git.kernel.org/stable/c/31594d4872dfdbad767e67fcc74bcd0a31f02150>
- other: <https://git.kernel.org/stable/c/f19a6264a62b910332a61523177b3cccf4bab46d>
- other: <https://git.kernel.org/stable/c/ec3a69e7c021cd826be8886ba6af4ee3147788fb>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2026-139629>

HTML: <https://flawdb.com/CVE-2026-139629> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-139629>
