Linux Kernel LoongArch BPF Return Value Handling Vulnerability

Vulnerability

A vulnerability in the Linux kernel's handling of BPF return values on LoongArch architecture has been addressed. The issue arose because the BPF verifier test 'calls: div by 0 in subprog' caused a panic when the 'ld.bu' instruction attempted to load a byte from a memory address returned by a subprogram. The subprogram correctly set the return address in the 'a5' register, which is designated for BPF return values. However, a previous commit sign-extended the 'a5' register to the 'a0' register, which is the standard return value register in LoongArch. This modification inadvertently disrupted BPF-to-BPF calls, which require the return value in the 'a5' register to be zero-extended. The vulnerability has been resolved by ensuring that the 'a0' to 'a5' transfer only occurs for native calls, not BPF-to-BPF calls.

Impact

Exploitation of this vulnerability could lead to incorrect handling of return values in BPF subprograms, potentially causing panics or other unintended behaviors in the kernel.

Added: Jun 9, 2025, 7:46 PM
Updated: Jun 9, 2025, 7:46 PM

Vulnerability Rating

Custom Algorithm
spread
9.0
impact
2.5
exploitability
3.5
remediation
0.0
relevance
0.0
threat
3.2
urgency
2.9
incentive
1.7

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.