CVE-2026-139320

bpf: Look at all 64 bits of a BPF_JSET mask on 32-bit

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

bpf: Look at all 64 bits of a BPF_JSET mask on 32-bit

In the branch of a BPF_JSET which is taken, the verifier can learn
something about the register only if the mask has a single bit: then this
bit is set. regs_refine_cond_op() tests this with is_power_of_2(val) and
then ORs val into var_off.

val is a u64, but is_power_of_2() takes an unsigned long. On a 32-bit
kernel it only sees the lower half of the mask. For

if r1 & 0xffffffff80000000 goto l

which is a BPF_JSET | BPF_K with an immediate of 0x80000000, the lower
half is a power of two. So the verifier takes all 33 bits for set at l,
while the branch is taken if any of them is. A mask of 0x100000001 from a
register does the same for bit 0.

The log of an i386 kernel, for r6 = bpf_get_prandom_u32() << 31:

3: (45) if r6 & 0x80000000 goto pc+2
from 3 to 6: R6=0xffffffff80000000 R10=fp0
6: (77) r6 >>= 63 ; R6=1

When the program runs, r6 >> 63 is 0.

>From then on the verifier works with known bits which the register does
not have at run time. It accepts, for example, an offset into a map value
which it derives from these bits and believes to be constant, and the
program can access memory outside of the map value.

Count the bits of the whole value.

Only 32-bit kernels are affected. On a 64-bit kernel unsigned long holds
the whole mask, and this patch changes nothing.

Analysis

AI-generated

Technical impact

The Linux kernel BPF verifier mishandles 64‑bit mask values on 32‑bit architectures. In a BPF_JSET instruction, the verifier tests whether the mask is a power of two using is_power_of_2(val), which operates on an unsigned long. On a 32‑bit kernel, unsigned long contains only the lower half of the 64‑bit mask. When the high bits contain a power‑of‑two position, the verifier incorrectly records a constant offset that is not present at runtime. This discrepancy allows a BPF program to calculate an index into a map value that lies outside its allocated bounds, enabling the program to read or write arbitrary kernel memory beyond the map.

Affected Systems

Only 32‑bit Linux kernels are impacted. The description explicitly refers to an i386 kernel, and it is inferred that other 32‑bit variants inherit the same unsigned‑long size limitation and therefore are also vulnerable unless the patch has been applied.

Risk and Exploitability

No public exploit has been reported and the vulnerability is not listed in CISA’s KEV catalog. The EPSS score is not available, suggesting a low probability of widespread exploitation under typical conditions. However, the flaw can be leveraged by an attacker who can load a custom BPF program with elevated privileges, such as CAP_SYS_ADMIN, to achieve privilege escalation, cause kernel crashes, or write arbitrary data in kernel memory. The potential impact is high and the risk remains significant until a patched kernel is deployed.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade the Linux kernel to a release that includes the BPF mask‑handling patch.
  • If an immediate upgrade is not feasible, disable BPF JIT or prevent loading of BPF programs by setting sysctl net.core.bpf_jit_enable=0 and removing CAP_SYS_ADMIN from untrusted users.
  • Continuously audit BPF map access patterns and monitor system logs for unexpected BPF activity to detect potential abuse.

Generated by OpenCVE AI on December 1, 2026 at 07:15 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Weaknesses CWE-122
Type Values Removed Values Added
Metrics cvssV3_1

{'score': 7.8, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H'}

Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: bpf: Look at all 64 bits of a BPF_JSET mask on 32-bit In the branch of a BPF_JSET which is taken, the verifier can learn something about the register only if the mask has a single bit: then this bit is set. regs_refine_cond_op() tests this with is_power_of_2(val) and then ORs val into var_off. val is a u64, but is_power_of_2() takes an unsigned long. On a 32-bit kernel it only sees the lower half of the mask. For if r1 & 0xffffffff80000000 goto l which is a BPF_JSET | BPF_K with an immediate of 0x80000000, the lower half is a power of two. So the verifier takes all 33 bits for set at l, while the branch is taken if any of them is. A mask of 0x100000001 from a register does the same for bit 0. The log of an i386 kernel, for r6 = bpf_get_prandom_u32() << 31: 3: (45) if r6 & 0x80000000 goto pc+2 from 3 to 6: R6=0xffffffff80000000 R10=fp0 6: (77) r6 >>= 63 ; R6=1 When the program runs, r6 >> 63 is 0. >From then on the verifier works with known bits which the register does not have at run time. It accepts, for example, an offset into a map value which it derives from these bits and believes to be constant, and the program can access memory outside of the map value. Count the bits of the whole value. Only 32-bit kernels are affected. On a 64-bit kernel unsigned long holds the whole mask, and this patch changes nothing.
Title bpf: Look at all 64 bits of a BPF_JSET mask on 32-bit
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References
Weaknesses
  • CWE-122

    Heap-based Buffer Overflow

  • CWE-823

    Use of Out-of-range Pointer Offset

Sources

Status
PUBLISHED
Assigner
Linux
Published
Updated
Dec 1, 2026, 5:42 AM
Reserved
Nov 30, 2026, 1:22 PM
Status
Received
Published
Nov 30, 2026, 2:18 PM
Modified
Dec 1, 2026, 6:17 AM
Severity
Important
Public date
Nov 30, 2026, 1:33 PM