Skip to content
Medium 6.7

powerpc/bpf: fix buffer overflow in JIT for large BPF programs

CVE-2026-138941 First seen on SecPulse

Affected packages

PackageAffected → Fixed
LinuxLinux —
LinuxKernel
≥ 5.18.0, < 6.1.193→ 6.1.193
≥ 6.2.0, < 6.6.163→ 6.6.163
≥ 6.7.0, < 6.12.118→ 6.12.118
≥ 6.13.0, < 6.18.64→ 6.18.64
≥ 6.19.0, < 7.3.4→ 7.3.4

Fix status by distribution

Records published by each distribution for this CVE. Fixed versions differ by release; check each link.

Original description The description as published by the source.

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

powerpc/bpf: fix buffer overflow in JIT for large BPF programs

During size calculation in pass-0, exit_addr is 0 since addrs[fp->len]
is not yet populated. bpf_jit_emit_exit_insn() treats a zero exit_addr
as in-range and skips bpf_jit_build_epilogue(), so the alternate inline
epilogue instructions are not counted in alloclen.

In later passes, if the real exit_addr falls outside the 32MB branch
range, the full inline epilogue is emitted into the already-allocated
buffer, writing past its end and corrupting adjacent memory.

Fix by ensuring exit_addr is non-zero before treating it as in-range,
so pass-0 always falls through to bpf_jit_build_epilogue() and
conservatively accounts for all epilogue instructions in alloclen.
Also range check alt_exit_addr directly in the else-if condition.

Since exit_addr handling now falls through to the epilogue, two
related issues in bpf_int_jit_compile() must also be addressed:

  1. Reset cgctx.alt_exit_addr before the second size-calculation pass.
    Without this, a stale alt_exit_addr from the first pass causes the
    second pass to emit a single jump instead of the full epilogue,
    undercounting alloclen and reintroducing the overflow.

  2. Recompute addrs[fp->len] at the end of each code-generation pass.
    The larger pass-0 body can shrink in later passes as out-of-range
    exits settle into in-range jumps; a stale addrs[fp->len] would
    leave exit branches targeting p…

Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory

References

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details