* CVE-2026-139163: bpf: Keep stack arguments in arch_bpf_timed_may_goto()
@ 2026-11-30 13:32 Greg Kroah-Hartman
0 siblings, 0 replies; only message in thread
From: Greg Kroah-Hartman @ 2026-11-30 13:32 UTC (permalink / raw)
To: linux-cve-announce; +Cc: Greg Kroah-Hartman
From: Greg Kroah-Hartman <gregkh@kernel.org>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
bpf: Keep stack arguments in arch_bpf_timed_may_goto()
The JITs pass the first stack arguments of a call in registers:
x86-64 r9 argument 6
arm64 x5-x7 arguments 6-8
riscv64 a5-a7 arguments 6-8
'*(u64 *)(r11 - 8) = rX' writes such a register in the caller.
'rX = *(u64 *)(r11 + 8)' reads it in the callee. A call changes these
registers. Thus the verifier accepts no call between the write and the call
of the callee, and no call in the callee before the read.
may_goto is not a call for the verifier. But one time in 65535 iterations
it calls arch_bpf_timed_may_goto(), and this function calls C code. It
saves R0-R5 only.
*(u64 *)(r11 - 8) = 0 ; the verifier: argument 6 is 0
call sub
sub:
1: may_goto 2f ; C code changes r9
goto 1b
2: r2 = *(u64 *)(r11 + 8) ; r2 is a kernel address
r1 = map_value
r1 += r2
*(u64 *)(r1 + 0) = 0
On x86-64 the C code changes r9 when the time of may_goto is up. With the
hpet clocksource a look at the clock changes r9 too. The prog above crashes
the kernel. LLVM does not emit such code: it reads stack arguments at the
entry of a function, and it writes them immediately before the call.
Save and restore these registers too. The cost is 2 insns on x86-64, 4 on
arm64 and 6 on riscv64, one time in 65535 iterations.
The Linux kernel CVE team has assigned CVE-2026-139163 to this issue.
Affected and fixed versions
===========================
Issue introduced in 7.2 with commit 324c3ca6eed6fb7ec4e50f31d537953038b13c5f and fixed in 7.3.6 with commit 009c5c6acd08f93a9bbf55c0881ae06cc221247a
Issue introduced in 7.2 with commit 324c3ca6eed6fb7ec4e50f31d537953038b13c5f and fixed in 7.4-rc1 with commit 4d0f560f4926417f010ce38f8628c41bcad29c9f
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-139163
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:
arch/arm64/net/bpf_timed_may_goto.S
arch/riscv/net/bpf_timed_may_goto.S
arch/x86/net/bpf_timed_may_goto.S
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/009c5c6acd08f93a9bbf55c0881ae06cc221247a
https://git.kernel.org/stable/c/4d0f560f4926417f010ce38f8628c41bcad29c9f
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-30 13:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 13:32 CVE-2026-139163: bpf: Keep stack arguments in arch_bpf_timed_may_goto() Greg Kroah-Hartman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.