# CVE-2025-21866: powerpc/code-patching: Fix KASAN hit by not flagging text patching area as VM\_ALLOC

> 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, CNA) `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.29% (percentile 14, 2026-11-26)
- **CWE:** CWE-770
- **Published:** 2025-03-12T09:42:22.587Z
- **Modified:** 2026-06-17T08:44:29.233Z

## Who should check

- Anyone running Linux \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< 97de5852058a299ba447cd9782fe96488d30108b; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< f8d4c5b653c1bc0df56e15658bbf64fc359adc4e; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< 6847b3e40bb963e57b61d1cc6fe84cb37b9d3d4c; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< c905a3053518212a1017e50bd2be3bee59305bb0; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< 2d542f13d26344e3452eee77613026ce9b653065; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< 8d06e9208184b2851fa79a3a39d6860320c8bdf8; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< 2e6c80423f201405fd65254e52decd21663896f3; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< d262a192d38e527faa5984629aabda2e0d1c4f54
- Anyone running Linux 4.13

## Description

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

powerpc/code-patching: Fix KASAN hit by not flagging text patching area as VM\_ALLOC

Erhard reported the following KASAN hit while booting his PowerMac G4
with a KASAN-enabled kernel 6.13-rc6:

  BUG: KASAN: vmalloc-out-of-bounds in copy\_to\_kernel\_nofault+0xd8/0x1c8
  Write of size 8 at addr f1000000 by task chronyd/1293

  CPU: 0 UID: 123 PID: 1293 Comm: chronyd Tainted: G        W          6.13.0-rc6-PMacG4 \#2
  Tainted: \[W\]=WARN
  Hardware name: PowerMac3,6 7455 0x80010303 PowerMac
  Call Trace:
  \[c2437590\] \[c1631a84\] dump\_stack\_lvl+0x70/0x8c (unreliable)
  \[c24375b0\] \[c0504998\] print\_report+0xdc/0x504
  \[c2437610\] \[c050475c\] kasan\_report+0xf8/0x108
  \[c2437690\] \[c0505a3c\] kasan\_check\_range+0x24/0x18c
  \[c24376a0\] \[c03fb5e4\] copy\_to\_kernel\_nofault+0xd8/0x1c8
  \[c24376c0\] \[c004c014\] patch\_instructions+0x15c/0x16c
  \[c2437710\] \[c00731a8\] bpf\_arch\_text\_copy+0x60/0x7c
  \[c2437730\] \[c0281168\] bpf\_jit\_binary\_pack\_finalize+0x50/0xac
  \[c2437750\] \[c0073cf4\] bpf\_int\_jit\_compile+0xb30/0xdec
  \[c2437880\] \[c0280394\] bpf\_prog\_select\_runtime+0x15c/0x478
  \[c24378d0\] \[c1263428\] bpf\_prepare\_filter+0xbf8/0xc14
  \[c2437990\] \[c12677ec\] bpf\_prog\_create\_from\_user+0x258/0x2b4
  \[c24379d0\] \[c027111c\] do\_seccomp+0x3dc/0x1890
  \[c2437ac0\] \[c001d8e0\] system\_call\_exception+0x2dc/0x420
  \[c2437f30\] \[c00281ac\] ret\_from\_syscall+0x0/0x2c
  --- interrupt: c00 at 0x5a1274
  NIP:  005a1274 LR: 006a3b3c CTR: 005296c8
  REGS: c2437f40 TRAP: 0c00   Tainted: G        W           (6.13.0-rc6-PMacG4)
  MSR:  0200f932 \<VEC,EE,PR,FP,ME,IR,DR,RI\>  CR: 24004422  XER: 00000000

  GPR00: 00000166 af8f3fa0 a7ee3540 00000001 00000000 013b6500 005a5858 0200f932
  GPR08: 00000000 00001fe9 013d5fc8 005296c8 2822244c 00b2fcd8 00000000 af8f4b57
  GPR16: 00000000 00000001 00000000 00000000 00000000 00000001 00000000 00000002
  GPR24: 00afdbb0 00000000 00000000 00000000 006e0004 013ce060 006e7c1c 00000001
  NIP \[005a1274\] 0x5a1274
  LR \[006a3b3c\] 0x6a3b3c
  --- interrupt: c00

  The buggy address belongs to the virtual mapping at
   \[f1000000, f1002000) created by:
   text\_area\_cpu\_up+0x20/0x190

  The buggy address belongs to the physical page:
  page: refcount:1 mapcount:0 mapping:00000000 index:0x0 pfn:0x76e30
  flags: 0x80000000(zone=2)
  raw: 80000000 00000000 00000122 00000000 00000000 00000000 ffffffff 00000001
  raw: 00000000
  page dumped because: kasan: bad access detected

  Memory state around the buggy address:
   f0ffff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
   f0ffff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  \>f1000000: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
             ^
   f1000080: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
   f1000100: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
  ==================================================================

f8 corresponds to KASAN\_VMALLOC\_INVALID which means the area is not
initialised hence not supposed to be used yet.

Powerpc text patching infrastructure allocates a virtual memory area
using get\_vm\_area() and flags it as VM\_ALLOC. But that flag is meant
to be used for vmalloc() and vmalloc() allocated memory is not
supposed to be used before a call to \_\_vmalloc\_node\_range() which is
never called for that area.

That went undetected until commit e4137f08816b ("mm, kasan, kmsan:
instrument copy\_from/to\_kernel\_nofault")

The area allocated by text\_area\_cpu\_up() is not vmalloc memory, it is
mapped directly on demand when needed by map\_kernel\_page(). There is
no VM flag corresponding to such usage, so just pass no flag. That way
the area will be unpoisonned and usable immediately.

## Affected and fixed versions

- Linux: \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< 97de5852058a299ba447cd9782fe96488d30108b; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< f8d4c5b653c1bc0df56e15658bbf64fc359adc4e; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< 6847b3e40bb963e57b61d1cc6fe84cb37b9d3d4c; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< c905a3053518212a1017e50bd2be3bee59305bb0; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< 2d542f13d26344e3452eee77613026ce9b653065; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< 8d06e9208184b2851fa79a3a39d6860320c8bdf8; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< 2e6c80423f201405fd65254e52decd21663896f3; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< d262a192d38e527faa5984629aabda2e0d1c4f54 (cvelist)
- Linux: 4.13 (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-21866. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-21866.md
Affected: Linux >= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, < 97de5852058a299ba447cd9782fe96488d30108b; >= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, < f8d4c5b653c1bc0df56e15658bbf64fc359adc4e; >= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, < 6847b3e40bb963e57b61d1cc6fe84cb37b9d3d4c; >= 37bc3e5fd764fb258ff4fcb…
Fixed in: Linux 97de5852058a299ba447cd9782fe96488d30108b, Linux 6847b3e40bb963e57b61d1cc6fe84cb37b9d3d4c, Linux 2d542f13d26344e3452eee77613026ce9b653065, Linux 8d06e9208184b2851fa79a3a39d6860320c8bdf8, Linux 2e6c80423f201405fd65254e52decd21663896f3

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

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

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

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

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

Linux \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< 97de5852058a299ba447cd9782fe96488d30108b; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< f8d4c5b653c1bc0df56e15658bbf64fc359adc4e; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< 6847b3e40bb963e57b61d1cc6fe84cb37b9d3d4c; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< c905a3053518212a1017e50bd2be3bee59305bb0; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< 2d542f13d26344e3452eee77613026ce9b653065; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< 8d06e9208184b2851fa79a3a39d6860320c8bdf8; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< 2e6c80423f201405fd65254e52decd21663896f3; \>= 37bc3e5fd764fb258ff4fcbb90b6d1b67fb466c1, \< d262a192d38e527faa5984629aabda2e0d1c4f54; Linux 4.13.

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

Yes. Fixed in Linux 97de5852058a299ba447cd9782fe96488d30108b, Linux 6847b3e40bb963e57b61d1cc6fe84cb37b9d3d4c, Linux 2d542f13d26344e3452eee77613026ce9b653065, Linux 8d06e9208184b2851fa79a3a39d6860320c8bdf8, Linux 2e6c80423f201405fd65254e52decd21663896f3. No fix listed yet: follow the vendor advisory.

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

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/97de5852058a299ba447cd9782fe96488d30108b>
- patch: <https://git.kernel.org/stable/c/f8d4c5b653c1bc0df56e15658bbf64fc359adc4e>
- patch: <https://git.kernel.org/stable/c/6847b3e40bb963e57b61d1cc6fe84cb37b9d3d4c>
- patch: <https://git.kernel.org/stable/c/c905a3053518212a1017e50bd2be3bee59305bb0>
- patch: <https://git.kernel.org/stable/c/2d542f13d26344e3452eee77613026ce9b653065>
- patch: <https://git.kernel.org/stable/c/8d06e9208184b2851fa79a3a39d6860320c8bdf8>
- patch: <https://git.kernel.org/stable/c/2e6c80423f201405fd65254e52decd21663896f3>
- patch: <https://git.kernel.org/stable/c/d262a192d38e527faa5984629aabda2e0d1c4f54>
- other: <https://lists.debian.org/debian-lts-announce/2025/05/msg00045.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-21866>

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