VDB

CVE-2025-38170

CVE-2025-38170 PUBLISHED

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

Reported by linux · Published July 3, 2025

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 ]

Fixed versions

Upgrade to a fixed version or later. Language registries are listed first, then Linux distributions, then vendor products.

PackageEcosystemFixed in
kernel-develAmazon Linux6.12.35-55.103.amzn2023

Affected products

VendorProductVersions
LinuxLinux8bd7f91c03d886f41d35f6108078d20be5a4a1bd, 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, 8bd7f91c03d886f41d35f6108078d20be5a4a1bd
LinuxLinux5.19, 0, 6.1.142
amazon:2023kernel-devel0
LinuxLinux8bd7f91c03d886f41d35f6108078d20be5a4a1bd, 8bd7f91c03d886f41d35f6108078d20be5a4a1bd, 6.16
amazon:2023kernel-libbpf-static0
linuxlinux_kernel5.19, 5.19, 5.19
amazon:2023python3-perf6.120
amazon:2023perf6.120
amazon:2023bpftool0
amazon:2023kernel-livepatch-6.12.35-55.1030
amazon:2023kernel-tools0
amazon:2023kernel-tools-devel0
amazon:2023kernel6.12-modules-extra0
amazon:2023kernel-libbpf-devel0
amazon:2023kernel-libbpf0
amazon:2023kernel6.120
amazon:2023kernel-modules-extra-common0
amazon:2023kernel-headers0

Timeline

  • Jul 2, 2025 CVE Published
  • Jul 3, 2025 EPSS Score (30 in total, the first dated here)
  • Oct 12, 2025 PoC Published (16 in total, the first dated here)
  • Nov 17, 2025 CVE Updated
  • Mar 29, 2026 Distribution Patch (224 in total, the first dated here)
  • Mar 29, 2026 Security Advisory (238 in total, the first dated here)
  • Jun 9, 2026 Coalition ESS Score

Query this with the API

The same record, from the CLI:

vulnetix vdb vuln CVE-2025-38170
vulnetix vdb fixes CVE-2025-38170

Or with curl, using the org id and key from your account page:

curl -s -H "Authorization: ApiKey ${VULNETIX_ORG_ID}:${VULNETIX_API_KEY}" \
  "https://api.vdb.vulnetix.com/v2/vuln/CVE-2025-38170/fixes/registry"

The Community plan is free and allows 50 queries a day. Get a free API key · API quickstart

Look up in the Resolve Platform →
$ Lookup Community · 50/day Open Lookup ›