# CVE-2025-40079: riscv, bpf: Sign extend struct ops return values properly

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.24% (percentile 9, 2026-11-26)
- **Published:** 2025-10-28T11:48:44.122Z
- **Modified:** 2026-10-19T21:10:00.160Z

## Who should check

- Anyone running Linux \>= 25ad10658dc1068a671553ff10e19a812c2a3783, \< 92751937f12a7d34ad492577a251c94a55e97e72; \>= 25ad10658dc1068a671553ff10e19a812c2a3783, \< 918a399501e28e0cc36dbd1fcfb4208f8aa1e4d1; \>= 25ad10658dc1068a671553ff10e19a812c2a3783, \< fd2e08128944a7679e753f920e9eda72057e427c
- Anyone running Linux 6.6

## Description

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

riscv, bpf: Sign extend struct ops return values properly

The ns\_bpf\_qdisc selftest triggers a kernel panic:

    Unable to handle kernel paging request at virtual address ffffffffa38dbf58
    Current test\_progs pgtable: 4K pagesize, 57-bit VAs, pgdp=0x00000001109cc000
    \[ffffffffa38dbf58\] pgd=000000011fffd801, p4d=000000011fffd401, pud=000000011fffd001, pmd=0000000000000000
    Oops \[\#1\]
    Modules linked in: bpf\_testmod(OE) xt\_conntrack nls\_iso8859\_1 \[...\] \[last unloaded: bpf\_testmod(OE)\]
    CPU: 1 UID: 0 PID: 23584 Comm: test\_progs Tainted: G        W  OE       6.17.0-rc1-g2465bb83e0b4 \#1 NONE
    Tainted: \[W\]=WARN, \[O\]=OOT\_MODULE, \[E\]=UNSIGNED\_MODULE
    Hardware name: Unknown Unknown Product/Unknown Product, BIOS 2024.01+dfsg-1ubuntu5.1 01/01/2024
    epc : \_\_qdisc\_run+0x82/0x6f0
     ra : \_\_qdisc\_run+0x6e/0x6f0
    epc : ffffffff80bd5c7a ra : ffffffff80bd5c66 sp : ff2000000eecb550
     gp : ffffffff82472098 tp : ff60000096895940 t0 : ffffffff8001f180
     t1 : ffffffff801e1664 t2 : 0000000000000000 s0 : ff2000000eecb5d0
     s1 : ff60000093a6a600 a0 : ffffffffa38dbee8 a1 : 0000000000000001
     a2 : ff2000000eecb510 a3 : 0000000000000001 a4 : 0000000000000000
     a5 : 0000000000000010 a6 : 0000000000000000 a7 : 0000000000735049
     s2 : ffffffffa38dbee8 s3 : 0000000000000040 s4 : ff6000008bcda000
     s5 : 0000000000000008 s6 : ff60000093a6a680 s7 : ff60000093a6a6f0
     s8 : ff60000093a6a6ac s9 : ff60000093140000 s10: 0000000000000000
     s11: ff2000000eecb9d0 t3 : 0000000000000000 t4 : 0000000000ff0000
     t5 : 0000000000000000 t6 : ff60000093a6a8b6
    status: 0000000200000120 badaddr: ffffffffa38dbf58 cause: 000000000000000d
    \[\<ffffffff80bd5c7a\>\] \_\_qdisc\_run+0x82/0x6f0
    \[\<ffffffff80b6fe58\>\] \_\_dev\_queue\_xmit+0x4c0/0x1128
    \[\<ffffffff80b80ae0\>\] neigh\_resolve\_output+0xd0/0x170
    \[\<ffffffff80d2daf6\>\] ip6\_finish\_output2+0x226/0x6c8
    \[\<ffffffff80d31254\>\] ip6\_finish\_output+0x10c/0x2a0
    \[\<ffffffff80d31446\>\] ip6\_output+0x5e/0x178
    \[\<ffffffff80d2e232\>\] ip6\_xmit+0x29a/0x608
    \[\<ffffffff80d6f4c6\>\] inet6\_csk\_xmit+0xe6/0x140
    \[\<ffffffff80c985e4\>\] \_\_tcp\_transmit\_skb+0x45c/0xaa8
    \[\<ffffffff80c995fe\>\] tcp\_connect+0x9ce/0xd10
    \[\<ffffffff80d66524\>\] tcp\_v6\_connect+0x4ac/0x5e8
    \[\<ffffffff80cc19b8\>\] \_\_inet\_stream\_connect+0xd8/0x318
    \[\<ffffffff80cc1c36\>\] inet\_stream\_connect+0x3e/0x68
    \[\<ffffffff80b42b20\>\] \_\_sys\_connect\_file+0x50/0x88
    \[\<ffffffff80b42bee\>\] \_\_sys\_connect+0x96/0xc8
    \[\<ffffffff80b42c40\>\] \_\_riscv\_sys\_connect+0x20/0x30
    \[\<ffffffff80e5bcae\>\] do\_trap\_ecall\_u+0x256/0x378
    \[\<ffffffff80e69af2\>\] handle\_exception+0x14a/0x156
    Code: 892a 0363 1205 489c 8bc1 c7e5 2d03 084a 2703 080a (2783) 0709
    ---\[ end trace 0000000000000000 \]---

The bpf\_fifo\_dequeue prog returns a skb which is a pointer. The pointer
is treated as a 32bit value and sign extend to 64bit in epilogue. This
behavior is right for most bpf prog types but wrong for struct ops which
requires RISC-V ABI.

So let's sign extend struct ops return values according to the function
model and RISC-V ABI(\[0\]).

  \[0\]: https://riscv.org/wp-content/uploads/2024/12/riscv-calling.pdf

## Affected and fixed versions

- Linux: \>= 25ad10658dc1068a671553ff10e19a812c2a3783, \< 92751937f12a7d34ad492577a251c94a55e97e72; \>= 25ad10658dc1068a671553ff10e19a812c2a3783, \< 918a399501e28e0cc36dbd1fcfb4208f8aa1e4d1; \>= 25ad10658dc1068a671553ff10e19a812c2a3783, \< fd2e08128944a7679e753f920e9eda72057e427c (cvelist)
- Linux: 6.6 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2025-40079. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-40079.md
Affected: Linux >= 25ad10658dc1068a671553ff10e19a812c2a3783, < 92751937f12a7d34ad492577a251c94a55e97e72; >= 25ad10658dc1068a671553ff10e19a812c2a3783, < 918a399501e28e0cc36dbd1fcfb4208f8aa1e4d1; >= 25ad10658dc1068a671553ff10e19a812c2a3783, < fd2e08128944a7679e753f920e9eda72057e427c; Linux 6.6
Fixed in: Linux 92751937f12a7d34ad492577a251c94a55e97e72, Linux 918a399501e28e0cc36dbd1fcfb4208f8aa1e4d1

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2025-40079 being exploited?

There is no confirmed exploitation: CVE-2025-40079 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.24% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2025-40079?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2025-40079?

Linux \>= 25ad10658dc1068a671553ff10e19a812c2a3783, \< 92751937f12a7d34ad492577a251c94a55e97e72; \>= 25ad10658dc1068a671553ff10e19a812c2a3783, \< 918a399501e28e0cc36dbd1fcfb4208f8aa1e4d1; \>= 25ad10658dc1068a671553ff10e19a812c2a3783, \< fd2e08128944a7679e753f920e9eda72057e427c; Linux 6.6.

### Is there a fix for CVE-2025-40079?

Yes. Fixed in Linux 92751937f12a7d34ad492577a251c94a55e97e72, Linux 918a399501e28e0cc36dbd1fcfb4208f8aa1e4d1. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2025-40079?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- other: <https://git.kernel.org/stable/c/92751937f12a7d34ad492577a251c94a55e97e72>
- other: <https://git.kernel.org/stable/c/918a399501e28e0cc36dbd1fcfb4208f8aa1e4d1>
- other: <https://git.kernel.org/stable/c/fd2e08128944a7679e753f920e9eda72057e427c>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2025-40079>

HTML: <https://flawdb.com/CVE-2025-40079> · JSON: <https://flawdb.com/api/v1/entries/CVE-2025-40079>
