# CVE-2025-38170: arm64/fpsimd: Discard stale CPU state when handling SME traps

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

- **Severity:** MEDIUM 5.5
- **CVSS:** 5.5 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; 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.27% (percentile 12, 2026-11-26)
- **Published:** 2025-07-03T08:36:09.012Z
- **Modified:** 2026-11-05T21:18:12.210Z

## Who should check

- Anyone running Linux \>= 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, \< de89368de3894a8db27caeb8fd902ba1c49f696a; \>= 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, \< 43be952e885476dafb74aa832c0847b2f4f650c6; \>= 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, \< 6103f9ba51a59afb5a0f32299c837377c5a5a693; \>= 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, \< c4a4786d93e99517d6f10ed56b9ffba4ce88d3b3; \>= 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, \< d3eaab3c70905c5467e5c4ea403053d67505adeb
- Anyone running Linux 5.19

## Description

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

arm64/fpsimd: Discard stale CPU state when handling SME traps

The logic for handling SME traps manipulates saved FPSIMD/SVE/SME state
incorrectly, and a race with preemption can result in a task having
TIF\_SME set and TIF\_FOREIGN\_FPSTATE clear even though the live CPU state
is stale (e.g. with SME traps enabled). This can result in warnings from
do\_sme\_acc() where SME traps are not expected while TIF\_SME is set:

\|        /\* With TIF\_SME userspace shouldn't generate any traps \*/
\|        if (test\_and\_set\_thread\_flag(TIF\_SME))
\|                WARN\_ON(1);

This is very similar to the SVE issue we fixed in commit:

  751ecf6afd6568ad ("arm64/sve: Discard stale CPU state when handling SVE traps")

The race can occur when the SME trap handler is preempted before and
after manipulating the saved FPSIMD/SVE/SME state, starting and ending on
the same CPU, e.g.

\| void do\_sme\_acc(unsigned long esr, struct pt\_regs \*regs)
\| {
\|         // Trap on CPU 0 with TIF\_SME clear, SME traps enabled
\|         // task-\>fpsimd\_cpu is 0.
\|         // per\_cpu\_ptr(&fpsimd\_last\_state, 0) is task.
\|
\|         ...
\|
\|         // Preempted; migrated from CPU 0 to CPU 1.
\|         // TIF\_FOREIGN\_FPSTATE is set.
\|
\|         get\_cpu\_fpsimd\_context();
\|
\|         /\* With TIF\_SME userspace shouldn't generate any traps \*/
\|         if (test\_and\_set\_thread\_flag(TIF\_SME))
\|                 WARN\_ON(1);
\|
\|         if (!test\_thread\_flag(TIF\_FOREIGN\_FPSTATE)) {
\|                 unsigned long vq\_minus\_one =
\|                         sve\_vq\_from\_vl(task\_get\_sme\_vl(current)) - 1;
\|                 sme\_set\_vq(vq\_minus\_one);
\|
\|                 fpsimd\_bind\_task\_to\_cpu();
\|         }
\|
\|         put\_cpu\_fpsimd\_context();
\|
\|         // Preempted; migrated from CPU 1 to CPU 0.
\|         // task-\>fpsimd\_cpu is still 0
\|         // If per\_cpu\_ptr(&fpsimd\_last\_state, 0) is still task then:
\|         // - Stale HW state is reused (with SME traps enabled)
\|         // - TIF\_FOREIGN\_FPSTATE is cleared
\|         // - A return to userspace skips HW state restore
\| }

Fix the case where the state is not live and TIF\_FOREIGN\_FPSTATE is set
by calling fpsimd\_flush\_task\_state() to detach from the saved CPU
state. This ensures that a subsequent context switch will not reuse the
stale CPU state, and will instead set TIF\_FOREIGN\_FPSTATE, forcing the
new state to be reloaded from memory prior to a return to userspace.

Note: this was originallly posted as \[1\].

\[ Rutland: rewrite commit message \]

## Affected and fixed versions

- Linux: \>= 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, \< de89368de3894a8db27caeb8fd902ba1c49f696a; \>= 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, \< 43be952e885476dafb74aa832c0847b2f4f650c6; \>= 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, \< 6103f9ba51a59afb5a0f32299c837377c5a5a693; \>= 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, \< c4a4786d93e99517d6f10ed56b9ffba4ce88d3b3; \>= 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, \< d3eaab3c70905c5467e5c4ea403053d67505adeb (cvelist)
- Linux: 5.19 (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-38170. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-38170.md
Affected: Linux >= 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, < de89368de3894a8db27caeb8fd902ba1c49f696a; >= 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, < 43be952e885476dafb74aa832c0847b2f4f650c6; >= 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, < 6103f9ba51a59afb5a0f32299c837377c5a5a693; >= 8bd7f91c03d886f41d35f61…
Fixed in: Linux 43be952e885476dafb74aa832c0847b2f4f650c6, Linux 6103f9ba51a59afb5a0f32299c837377c5a5a693

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-38170 being exploited?

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

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

Medium: CVSS 5.5 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

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

Linux \>= 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, \< de89368de3894a8db27caeb8fd902ba1c49f696a; \>= 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, \< 43be952e885476dafb74aa832c0847b2f4f650c6; \>= 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, \< 6103f9ba51a59afb5a0f32299c837377c5a5a693; \>= 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, \< c4a4786d93e99517d6f10ed56b9ffba4ce88d3b3; \>= 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, \< d3eaab3c70905c5467e5c4ea403053d67505adeb; Linux 5.19.

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

Yes. Fixed in Linux 43be952e885476dafb74aa832c0847b2f4f650c6, Linux 6103f9ba51a59afb5a0f32299c837377c5a5a693. No fix listed yet: follow the vendor advisory.

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

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

- patch: <https://git.kernel.org/stable/c/de89368de3894a8db27caeb8fd902ba1c49f696a>
- patch: <https://git.kernel.org/stable/c/43be952e885476dafb74aa832c0847b2f4f650c6>
- patch: <https://git.kernel.org/stable/c/6103f9ba51a59afb5a0f32299c837377c5a5a693>
- patch: <https://git.kernel.org/stable/c/c4a4786d93e99517d6f10ed56b9ffba4ce88d3b3>
- patch: <https://git.kernel.org/stable/c/d3eaab3c70905c5467e5c4ea403053d67505adeb>
- other: <https://lists.debian.org/debian-lts-announce/2025/10/msg00008.html>

## 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-38170>

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