CVE-2025-38670
arm64/entry: Mask DAIF in cpu_switch_to(), call_on_irq_stack()
Reported by linux · Published August 22, 2025
In the Linux kernel, the following vulnerability has been resolved: arm64/entry: Mask DAIF in cpu_switch_to(), call_on_irq_stack() `cpu_switch_to()` and `call_on_irq_stack()` manipulate SP to change to different stacks along with the Shadow Call Stack if it is enabled. Those two stack changes cannot be done atomically and both functions can be interrupted by SErrors or Debug Exceptions which, though unlikely, is very much broken : if interrupted, we can end up with mismatched stacks and Shadow Call Stack leading to clobbered stacks. In `cpu_switch_to()`, it can happen when SP_EL0 points to the new task, but x18 stills points to the old task's SCS. When the interrupt handler tries to save the task's SCS pointer, it will save the old task SCS pointer (x18) into the new task struct (pointed to by SP_EL0), clobbering it. In `call_on_irq_stack()`, it can happen when switching from the task stack to the IRQ stack and when switching back. In both cases, we can be interrupted when the SCS pointer points to the IRQ SCS, but SP points to the task stack. The nested interrupt handler pushes its return addresses on the IRQ SCS. It then detects that SP points to the task stack, calls `call_on_irq_stack()` and clobbers the task SCS pointer with the IRQ SCS pointer, which it will also use ! This leads to tasks returning to addresses on the wrong SCS, or even on the IRQ SCS, triggering kernel panics via CONFIG_VMAP_STACK or FPAC if enabled. This is possible on a default config, but unlikely. However, when enabling CONFIG_ARM64_PSEUDO_NMI, DAIF is unmasked and instead the GIC is responsible for filtering what interrupts the CPU should receive based on priority. Given the goal of emulating NMIs, pseudo-NMIs can be received by the CPU even in `cpu_switch_to()` and `call_on_irq_stack()`, possibly *very* frequently depending on the system configuration and workload, leading to unpredictable kernel panics. Completely mask DAIF in `cpu_switch_to()` and restore it when returning. Do the same in `call_on_irq_stack()`, but restore and mask around the branch. Mask DAIF even if CONFIG_SHADOW_CALL_STACK is not enabled for consistency of behaviour between all configurations. Introduce and use an assembly macro for saving and masking DAIF, as the existing one saves but only masks IF.
Fixed versions
Upgrade to a fixed version or later. Language registries are listed first, then Linux distributions, then vendor products.
| Package | Ecosystem | Fixed in |
|---|---|---|
| bpftool | Amazon Linux | 1:6.1.150-174.273.amzn2023 |
| kernel6.12-libbpf | Amazon Linux | 1:6.12.46-66.121.amzn2023 |
| kernel6.12-libbpf-static | Amazon Linux | 1:6.12.46-66.121.amzn2023 |
| python3-perf | Amazon Linux | 1:6.1.150-174.273.amzn2023 |
| kernel-devel | Amazon Linux | 1:6.1.150-174.273.amzn2023 |
| kernel6.12-tools | Amazon Linux | 1:6.12.46-66.121.amzn2023 |
| perf | Amazon Linux | 1:6.1.150-174.273.amzn2023 |
| perf6.12 | Amazon Linux | 1:6.12.46-66.121.amzn2023 |
| kernel6.12-devel | Amazon Linux | 1:6.12.46-66.121.amzn2023 |
| kernel6.12 | Amazon Linux | 1:6.12.46-66.121.amzn2023 |
| kernel-tools-devel | Amazon Linux | 1:6.1.150-174.273.amzn2023 |
| kernel-livepatch-6.12.46-66.121 | Amazon Linux | 1:1.0-0.amzn2023 |
8 more packages have a fixed version. See every fix in Lookup.
Risk scores
Affected products
| Vendor | Product | Versions |
|---|---|---|
| Linux | Linux | 3f225f29c69c13ce1cbdb1d607a42efeef080056, 402d2b1d54b7085d0c3bfd01fd50c2701dde64b3, 4403c7b7e5e1ad09a266b6e399fd7bf97931508e |
| Linux | Linux | 6.3, 0, 5.10.210 |
| amazon:2023 | bpftool | 0 |
| amazon:2023 | kernel6.12-libbpf | 0 |
| amazon:2023 | kernel6.12-libbpf-static | 0 |
| amazon:2023 | python3-perf | 0 |
| amazon:2023 | kernel-devel | 0 |
| amazon:2023 | kernel6.12-tools | 0 |
| amazon:2023 | perf | 0 |
| amazon:2023 | perf6.12 | 0 |
| amazon:2023 | kernel6.12-devel | 0 |
| amazon:2023 | kernel6.12 | 0 |
| Siemens | SIMATIC CN 4100 | 0 |
| amazon:2023 | kernel-tools-devel | 0 |
| amazon:2023 | kernel-livepatch-6.12.46-66.121 | 0 |
| amazon:2023 | kernel6.12-headers | 0 |
| amazon:2023 | kernel-tools | 0 |
| amazon:2023 | kernel-livepatch-6.1.150-174.273 | 0 |
| amazon:2023 | kernel-modules-extra | 0 |
| amazon:2023 | bpftool6.12 | 0 |
…and 13 more
Timeline
- Aug 22, 2025 CVE Published
- Aug 23, 2025 EPSS Score (30 in total, the first dated here)
- Oct 12, 2025 PoC Published (10 in total, the first dated here)
- Feb 2, 2026 Security Advisory (222 in total, the first dated here)
- Mar 29, 2026 Distribution Patch (174 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-38670
vulnetix vdb fixes CVE-2025-38670
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-38670/fixes/registry"
The Community plan is free and allows 50 queries a day. Get a free API key · API quickstart