CVE-2026-98049: bpf: zero extend the result of an arena 32-bit cmpxchg
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
bpf: zero extend the result of an arena 32-bit cmpxchg
bpf_convert_ctx_accesses() rewrites an atomic on an arena pointer from BPF_STX | BPF_ATOMIC to BPF_STX | BPF_PROBE_ATOMIC, and it runs before bpf_opt_subreg_zext_lo32_rnd_hi32().
That pass emits an explicit zero extension for a 32-bit cmpxchg even when bpf_jit_needs_zext() is false. This is done because on some architectures 32-bit cmpxchg requires explicit zero extension for the dst register. E.g. on x86-64 'lock cmpxchg' does not change the %eax if comparison is successful, while BPF semantics declare that each operation on a 32-bit register zero extends it's upper half.
is_cmpxchg_insn() matches BPF_MODE == BPF_ATOMIC only, so an arena cmpxchg misses said zero extension adjustment. This patch adjusts is_cmpxchg_insn() to match BPF_PROBE_ATOMIC alongside BPF_ATOMIC.
The Linux kernel CVE team has assigned CVE-2026-98049 to this issue.
Affected and fixed versions
===========================
Issue introduced in 6.10 with commit d503a04f8bc0c75dc9db9452d8cc79d748afb752 and fixed in 7.2.7 with commit 1c1b476d43a8b6c9bc04600369dd8cc39950d98e Issue introduced in 6.10 with commit d503a04f8bc0c75dc9db9452d8cc79d748afb752 and fixed in 7.3-rc2 with commit 4814ed6406f3493bd554ad046da5f7fc04833571
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2026-98049
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
kernel/bpf/fixups.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/1c1b476d43a8b6c9bc04600369dd8cc39950d98e https://git.kernel.org/stable/c/4814ed6406f3493bd554ad046da5f7fc04833571