CVE-2025-37893: LoongArch: BPF: Fix off-by-one error in build_prologue()

Description

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

LoongArch: BPF: Fix off-by-one error in build_prologue()

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.

Classification

CVE ID: CVE-2025-37893

Affected Products

Vendor: Linux

Product: Linux

Exploit Prediction Scoring System (EPSS)

EPSS Score: 0.02% (probability of being exploited)

EPSS Percentile: 5.06% (scored less or equal to compared to others)

EPSS Date: 2025-04-18 (when was this score calculated)

References

https://nvd.nist.gov/vuln/detail/CVE-2025-37893
https://git.kernel.org/stable/c/e9ccb262b39ab01a5ac2e485b7996b8498e7b373
https://git.kernel.org/stable/c/b3ffad2f02db4aace6799fe0049508b8925eae45
https://git.kernel.org/stable/c/205a2182c51ffebaef54d643e3745e720cded08b
https://git.kernel.org/stable/c/c74d95a5679741ef428974ab788f5b0758dc78ae
https://git.kernel.org/stable/c/48b904de2408af5f936f0e03f48dfcddeab58aa0
https://git.kernel.org/stable/c/7e2586991e36663c9bc48c828b83eab180ad30a9

Timeline