Look up another CVE · open CVE-2025-37893 in the interactive tracker
CVE-2025-37893
LoongArch: BPF: Fix off-by-one error in build_prologue()
Published 2025-04-18 (18 months ago) by the Linux kernel CNA. Subsystem arch/loongarch. Debian urgency: not yet assigned.
What to do, per Debian release
Debian's own status for CVE-2025-37893 in every release this site tracks, and what each one means in practice. Every status below is the one the Debian Security Team publishes for this CVE. source
| Release | Status | Version | What this means |
|---|---|---|---|
| Debian 12bookworm | vulnerable | 6.1.190-1 | No fix published anywhere yet, neither in Debian nor upstream for the series bookworm tracks. Watch the Debian tracker page for this CVE. Advisories for bookworm have historically landed a median of 23 days after publication. |
| Debian 13trixie | fixed | 6.12.25-1 | Update the kernel and reboot. Fixed in 6.12.25-1. A running kernel keeps the old code until the machine restarts. |
| Debian 14forky | fixed | 6.12.25-1 | Update the kernel and reboot. Fixed in 6.12.25-1. A running kernel keeps the old code until the machine restarts. |
| Debian unstablesid | fixed | 6.12.25-1 | Update the kernel and reboot. Fixed in 6.12.25-1. A running kernel keeps the old code until the machine restarts. |
The vulnerability
What the bug is
Vincent reported that running BPF progs with tailcalls on LoongArch causes kernel hard lockup. Debugging the issues shows that the JITed image missing a jirl instruction at the end of the epilogue. There are two passes in JIT compiling, the first pass set the flags and the second pass generates JIT code based on those flags. With BPF progs mixing bpf2bpf and tailcalls, build_prologue() generates N insns in the first pass and then generates N+1 insns in the second pass. This makes epilogue_offset off by one and we will jump to some unexpected insn and cause lockup. Fix this by inserting a nop insn.
Where it lives
The fix touches these files. If the subsystem is one you do not use, the practical exposure is lower, though the package is still the vulnerable one.
arch/loongarch/net/bpf_jit.c
arch/loongarch/net/bpf_jit.h
- What this is
- BPF JIT for LOONGARCHMAINTAINERS section matched on arch/loongarch/net/ · bpf@vger.kernel.org · Maintained
Check it on the machine
grep -w CONFIG_BPF_JIT /boot/config-$(uname -r)Reads the booted kernel's own configuration, on the machine and nowhere else. =y is built in, =m is a module, and an is not set line means the code is not there.
Show whether Debian builds this, per release
Debian builds this, but not on every flavour. At least one release below builds the code on some of its kernel flavours and not on others, so the answer depends on the architecture and flavour installed.
- bookwormy
- trixie, forky, sidYnot built on s390x/s390x
- y
- built into the kernel image on every flavour - only a patch removes it
- Y
- built in where it is built at all; some flavours do not build it
- Build switch
- CONFIG_BPF_JIT
From the configuration Debian publishes for every kernel flavour it builds. It covers only the architectures Debian ships a linux-config package for, and nothing about a kernel you built yourself. Debian's own status above stays authoritative about the source package.MAINTAINERS kbuild Makefiles Debian linux-config packages
Signals
- Published
- 2025-04-18 (18 months ago)source
- CVSS
- 7.8 high
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:Hsource recompute it - Attack vector
- local (AV:L)source
- EPSS
- 0.28%, higher than 19.1% of all CVEssource
- CISA KEV
- not listedthe KEV catalogue
- Debian urgency
- not yet assignedsource
- Subsystem
- arch/loongarch
Upstream fixes
The versions the CNA records as introducing and fixing this, and the commit for each. source
| Introduced | Fixed in | Commit |
|---|---|---|
| 6.1 | 6.6.87 | b3ffad2f02db |
| 6.1 | 6.12.23 | 205a2182c51f |
| 6.1 | 6.13.11 | c74d95a56797 |
| 6.1 | 6.14.2 | 48b904de2408 |
| 6.1 | 6.15 | 7e2586991e36 |
Why the CNA scored it this way
Quoted from the kernel CNA's own scoring file, word for word. A highlighted metric carries the most severe value CVSS v3.1 defines for it, which is what pushes the score up. source
- AV:LAttack vector, local
- The vulnerability is triggered through the bpf(BPF_PROG_LOAD) syscall when the LoongArch JIT compiles an attacker-supplied program, and the miscompiled image is executed via a locally attached socket filter. Per kernel scoring guidance, BPF is a local attack vector.
- AC:LAttack complexity, low
- The miscompilation is fully deterministic — any program that sets both SAVE_RA and SAVE_TCC (one call plus one tail call) makes build_prologue() emit N+1 instructions in pass 2 versus N in pass 1. No race, no memory-layout luck, and the attacker authors the exact instruction sequence.
- PR:LPrivileges required, low
- BPF_MAP_TYPE_PROG_ARRAY is an unprivileged map type in map_create(), bpf_tail_call_proto is returned before the CAP_BPF gate in bpf_base_func_proto(), and BPF_PROG_TYPE_SOCKET_FILTER loads without CAP_BPF, so an ordinary local user can reach this where unprivileged BPF is enabled or CAP_BPF is delegated to a service.
- UI:NUser interaction, none
- The attacker loads and attaches the BPF program to a socket it owns and triggers execution itself; no action by any other user is required.
- S:UScope, unchanged
- The corruption and the wrong control flow occur inside the kernel's own JIT image and exception table, within the same security authority as the kernel itself.
- C:HConfidentiality impact, high
- The off-by-one epilogue branch executes an attacker-chosen instruction (e.g. a `ldd` load) with attacker-controlled register operands at kernel privilege, and the corrupted exception-table entry alters kernel fault fixup, both of which can be leveraged to read kernel memory.
- I:HIntegrity impact, high
- There is a 4-byte out-of-bounds write past prog_size into prog->aux->extable, plus attacker-directed execution of an arbitrary JIT-emitted instruction (including stores) with a mismatched stack frame — a kernel-mode write/control-flow primitive.
- A:HAvailability impact, high
- The reported and confirmed symptom is a kernel hard lockup, since the mis-targeted branch can loop indefinitely in kernel context; any unprivileged user able to load such a program can wedge the machine.