# CVE-2026-74751: riscv: lib: Fix ZBB strnlen reading past count boundary

> A boundary check error in the RISC-V ZBB strnlen implementation can cause a kernel fault when reading near page boundaries, leading to denial of service.

- **Severity:** Critical 9.4 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 26 Aug 2026
- **Updated:** 27 Aug 2026
- **Also known as:** DEBIAN-CVE-2026-74751, GHSA-ghc8-jmvh-q86v, UBUNTU-CVE-2026-74751

## What is CVE-2026-74751?

CVE-2026-74751 is a critical denial of service vulnerability in Linux, published on 26 Aug 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

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

riscv: lib: Fix ZBB strnlen reading past count boundary

The ZBB-optimized strnlen loop loads one word ahead before checking the
aligned boundary:

    REG_L   t1, SZREG(t0)       // load next word
    addi    t0, t0, SZREG       // advance
    orc.b   t1, t1
    bgeu    t0, t4, 4f          // boundary check AFTER load

where t4 = (s + count) & -SZREG.  When s is aligned and count is a
multiple of SZREG, t4 equals s + count and the loop loads a full word
starting at exactly s + count.  If s + count falls on a page boundary
with the next page unmapped, this faults.

Fix by computing the aligned boundary from the last valid byte
(s + count - 1) instead of s + count.  This makes the loop stop at the
word containing the last valid byte rather than potentially loading the
word after it.  The count == 0 case is already handled by the beqz
early exit.

Also add a pre-loop guard (bgeu t0, t4) for the case where all valid
bytes fit within the first word.  With the adjusted boundary, t4 can
equal t0, and entering the loop with stale register state from the
first-word processing would produce incorrect results.

The final minu clamp ensures the result is still correct when the last
loaded word extends past s + count - 1 within the same aligned word.

## Which versions are affected by CVE-2026-74751?


## How do I fix CVE-2026-74751?

Apply the vendor's patch.

## Is CVE-2026-74751 being exploited?

There is no known exploitation of CVE-2026-74751 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-74751 and fix it if it is affected.

What it is: CVE-2026-74751 is a critical denial of service vulnerability in Linux, published on 26 Aug 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-74751 in the wild and no public exploit code.

Affected product: Linux. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-74751/ (Markdown: https://insights.sbomify.com/CVE-2026-74751/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-74751
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-74751
- OSV: https://osv.dev/vulnerability/CVE-2026-74751

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-74751/
Summaries are generated and may contain mistakes; the official description above is the record.
