# CVE-2025-38241: mm/shmem, swap: fix softlockup with mTHP swapin

> 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.17% (percentile 4, 2026-11-26)
- **CWE:** CWE-667
- **Published:** 2025-07-09T10:42:24.777Z
- **Modified:** 2026-06-17T09:16:27.740Z

## Who should check

- Anyone running Linux \>= 1dd44c0af4fa1e80a4e82faa10cbf5d22da40362, \< 1283dfc1e0cd52cf525c2cb1b59a6f9183aab7ca; \>= 1dd44c0af4fa1e80a4e82faa10cbf5d22da40362, \< a05dd8ae5cbb1cb45f349922cfea4f548a5e5d6f
- Anyone running Linux 6.14

## Description

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

mm/shmem, swap: fix softlockup with mTHP swapin

Following softlockup can be easily reproduced on my test machine with:

echo always \> /sys/kernel/mm/transparent\_hugepage/hugepages-64kB/enabled
swapon /dev/zram0 \# zram0 is a 48G swap device
mkdir -p /sys/fs/cgroup/memory/test
echo 1G \> /sys/fs/cgroup/test/memory.max
echo $BASHPID \> /sys/fs/cgroup/test/cgroup.procs
while true; do
    dd if=/dev/zero of=/tmp/test.img bs=1M count=5120
    cat /tmp/test.img \> /dev/null
    rm /tmp/test.img
done

Then after a while:
watchdog: BUG: soft lockup - CPU\#0 stuck for 763s! \[cat:5787\]
Modules linked in: zram virtiofs
CPU: 0 UID: 0 PID: 5787 Comm: cat Kdump: loaded Tainted: G             L      6.15.0.orig-gf3021d9246bc-dirty \#118 PREEMPT(voluntary)·
Tainted: \[L\]=SOFTLOCKUP
Hardware name: Red Hat KVM/RHEL-AV, BIOS 0.0.0 02/06/2015
RIP: 0010:mpol\_shared\_policy\_lookup+0xd/0x70
Code: e9 b8 b4 ff ff 31 c0 c3 cc cc cc cc 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 66 0f 1f 00 0f 1f 44 00 00 41 54 55 53 \<48\> 8b 1f 48 85 db 74 41 4c 8d 67 08 48 89 fb 48 89 f5 4c 89 e7 e8
RSP: 0018:ffffc90002b1fc28 EFLAGS: 00000202
RAX: 00000000001c20ca RBX: 0000000000724e1e RCX: 0000000000000001
RDX: ffff888118e214c8 RSI: 0000000000057d42 RDI: ffff888118e21518
RBP: 000000000002bec8 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000bf4 R11: 0000000000000000 R12: 0000000000000001
R13: 00000000001c20ca R14: 00000000001c20ca R15: 0000000000000000
FS:  00007f03f995c740(0000) GS:ffff88a07ad9a000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f03f98f1000 CR3: 0000000144626004 CR4: 0000000000770eb0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
 \<TASK\>
 shmem\_alloc\_folio+0x31/0xc0
 shmem\_swapin\_folio+0x309/0xcf0
 ? filemap\_get\_entry+0x117/0x1e0
 ? xas\_load+0xd/0xb0
 ? filemap\_get\_entry+0x101/0x1e0
 shmem\_get\_folio\_gfp+0x2ed/0x5b0
 shmem\_file\_read\_iter+0x7f/0x2e0
 vfs\_read+0x252/0x330
 ksys\_read+0x68/0xf0
 do\_syscall\_64+0x4c/0x1c0
 entry\_SYSCALL\_64\_after\_hwframe+0x76/0x7e
RIP: 0033:0x7f03f9a46991
Code: 00 48 8b 15 81 14 10 00 f7 d8 64 89 02 b8 ff ff ff ff eb bd e8 20 ad 01 00 f3 0f 1e fa 80 3d 35 97 10 00 00 74 13 31 c0 0f 05 \<48\> 3d 00 f0 ff ff 77 4f c3 66 0f 1f 44 00 00 55 48 89 e5 48 83 ec
RSP: 002b:00007fff3c52bd28 EFLAGS: 00000246 ORIG\_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 0000000000040000 RCX: 00007f03f9a46991
RDX: 0000000000040000 RSI: 00007f03f98ba000 RDI: 0000000000000003
RBP: 00007fff3c52bd50 R08: 0000000000000000 R09: 00007f03f9b9a380
R10: 0000000000000022 R11: 0000000000000246 R12: 0000000000040000
R13: 00007f03f98ba000 R14: 0000000000000003 R15: 0000000000000000
 \</TASK\>

The reason is simple, readahead brought some order 0 folio in swap cache,
and the swapin mTHP folio being allocated is in conflict with it, so
swapcache\_prepare fails and causes shmem\_swap\_alloc\_folio to return
-EEXIST, and shmem simply retries again and again causing this loop.

Fix it by applying a similar fix for anon mTHP swapin.

The performance change is very slight, time of swapin 10g zero folios
with shmem (test for 12 times):
Before:  2.47s
After:   2.48s

\[kasong@tencent.com: add comment\]

## Affected and fixed versions

- Linux: \>= 1dd44c0af4fa1e80a4e82faa10cbf5d22da40362, \< 1283dfc1e0cd52cf525c2cb1b59a6f9183aab7ca; \>= 1dd44c0af4fa1e80a4e82faa10cbf5d22da40362, \< a05dd8ae5cbb1cb45f349922cfea4f548a5e5d6f (cvelist)
- Linux: 6.14 (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-38241. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-38241.md
Affected: Linux >= 1dd44c0af4fa1e80a4e82faa10cbf5d22da40362, < 1283dfc1e0cd52cf525c2cb1b59a6f9183aab7ca; >= 1dd44c0af4fa1e80a4e82faa10cbf5d22da40362, < a05dd8ae5cbb1cb45f349922cfea4f548a5e5d6f; Linux 6.14
Fixed in: Linux 1283dfc1e0cd52cf525c2cb1b59a6f9183aab7ca

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

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

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

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

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

Linux \>= 1dd44c0af4fa1e80a4e82faa10cbf5d22da40362, \< 1283dfc1e0cd52cf525c2cb1b59a6f9183aab7ca; \>= 1dd44c0af4fa1e80a4e82faa10cbf5d22da40362, \< a05dd8ae5cbb1cb45f349922cfea4f548a5e5d6f; Linux 6.14.

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

Yes. Fixed in Linux 1283dfc1e0cd52cf525c2cb1b59a6f9183aab7ca. No fix listed yet: follow the vendor advisory.

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

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/1283dfc1e0cd52cf525c2cb1b59a6f9183aab7ca>
- patch: <https://git.kernel.org/stable/c/a05dd8ae5cbb1cb45f349922cfea4f548a5e5d6f>

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

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