# CVE-2025-38517: lib/alloc\_tag: do not acquire non-existent lock in alloc\_tag\_top\_users()

> 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.26% (percentile 11, 2026-11-26)
- **CWE:** CWE-476
- **Published:** 2025-08-16T10:55:04.217Z
- **Modified:** 2026-06-17T09:17:01.753Z

## Who should check

- Anyone running Linux \>= 1438d349d16b78d88f9e978a4a5496f078c8191b, \< febc0b5dbabda414565bdfaaaa59d26f787d5fe7; \>= 1438d349d16b78d88f9e978a4a5496f078c8191b, \< 22bf79c0c2301b6e15a688220284b147774d277e; \>= 1438d349d16b78d88f9e978a4a5496f078c8191b, \< 99af22cd34688cc0d535a1919e0bea4cbc6c1ea1
- Anyone running Linux 6.10

## Description

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

lib/alloc\_tag: do not acquire non-existent lock in alloc\_tag\_top\_users()

alloc\_tag\_top\_users() attempts to lock alloc\_tag\_cttype-\>mod\_lock even
when the alloc\_tag\_cttype is not allocated because:

  1) alloc tagging is disabled because mem profiling is disabled
     (!alloc\_tag\_cttype)
  2) alloc tagging is enabled, but not yet initialized (!alloc\_tag\_cttype)
  3) alloc tagging is enabled, but failed initialization
     (!alloc\_tag\_cttype or IS\_ERR(alloc\_tag\_cttype))

In all cases, alloc\_tag\_cttype is not allocated, and therefore
alloc\_tag\_top\_users() should not attempt to acquire the semaphore.

This leads to a crash on memory allocation failure by attempting to
acquire a non-existent semaphore:

  Oops: general protection fault, probably for non-canonical address 0xdffffc000000001b: 0000 \[\#3\] SMP KASAN NOPTI
  KASAN: null-ptr-deref in range \[0x00000000000000d8-0x00000000000000df\]
  CPU: 2 UID: 0 PID: 1 Comm: systemd Tainted: G      D             6.16.0-rc2 \#1 VOLUNTARY
  Tainted: \[D\]=DIE
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
  RIP: 0010:down\_read\_trylock+0xaa/0x3b0
  Code: d0 7c 08 84 d2 0f 85 a0 02 00 00 8b 0d df 31 dd 04 85 c9 75 29 48 b8 00 00 00 00 00 fc ff df 48 8d 6b 68 48 89 ea 48 c1 ea 03 \<80\> 3c 02 00 0f 85 88 02 00 00 48 3b 5b 68 0f 85 53 01 00 00 65 ff
  RSP: 0000:ffff8881002ce9b8 EFLAGS: 00010016
  RAX: dffffc0000000000 RBX: 0000000000000070 RCX: 0000000000000000
  RDX: 000000000000001b RSI: 000000000000000a RDI: 0000000000000070
  RBP: 00000000000000d8 R08: 0000000000000001 R09: ffffed107dde49d1
  R10: ffff8883eef24e8b R11: ffff8881002cec20 R12: 1ffff11020059d37
  R13: 00000000003fff7b R14: ffff8881002cec20 R15: dffffc0000000000
  FS:  00007f963f21d940(0000) GS:ffff888458ca6000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 00007f963f5edf71 CR3: 000000010672c000 CR4: 0000000000350ef0
  Call Trace:
   \<TASK\>
   codetag\_trylock\_module\_list+0xd/0x20
   alloc\_tag\_top\_users+0x369/0x4b0
   \_\_show\_mem+0x1cd/0x6e0
   warn\_alloc+0x2b1/0x390
   \_\_alloc\_frozen\_pages\_noprof+0x12b9/0x21a0
   alloc\_pages\_mpol+0x135/0x3e0
   alloc\_slab\_page+0x82/0xe0
   new\_slab+0x212/0x240
   \_\_\_slab\_alloc+0x82a/0xe00
   \</TASK\>

As David Wang points out, this issue became easier to trigger after commit
780138b12381 ("alloc\_tag: check mem\_profiling\_support in alloc\_tag\_init").

Before the commit, the issue occurred only when it failed to allocate and
initialize alloc\_tag\_cttype or if a memory allocation fails before
alloc\_tag\_init() is called.  After the commit, it can be easily triggered
when memory profiling is compiled but disabled at boot.

To properly determine whether alloc\_tag\_init() has been called and its
data structures initialized, verify that alloc\_tag\_cttype is a valid
pointer before acquiring the semaphore.  If the variable is NULL or an
error value, it has not been properly initialized.  In such a case, just
skip and do not attempt to acquire the semaphore.

\[harry.yoo@oracle.com: v3\]

## Affected and fixed versions

- Linux: \>= 1438d349d16b78d88f9e978a4a5496f078c8191b, \< febc0b5dbabda414565bdfaaaa59d26f787d5fe7; \>= 1438d349d16b78d88f9e978a4a5496f078c8191b, \< 22bf79c0c2301b6e15a688220284b147774d277e; \>= 1438d349d16b78d88f9e978a4a5496f078c8191b, \< 99af22cd34688cc0d535a1919e0bea4cbc6c1ea1 (cvelist)
- Linux: 6.10 (cvelist)

## Mitigation

- Upgrade Linux to 99af22cd34688cc0d535a1919e0bea4cbc6c1ea1 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2025-38517. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-38517.md
Affected: Linux >= 1438d349d16b78d88f9e978a4a5496f078c8191b, < febc0b5dbabda414565bdfaaaa59d26f787d5fe7; >= 1438d349d16b78d88f9e978a4a5496f078c8191b, < 22bf79c0c2301b6e15a688220284b147774d277e; >= 1438d349d16b78d88f9e978a4a5496f078c8191b, < 99af22cd34688cc0d535a1919e0bea4cbc6c1ea1; Linux 6.10
Fixed in: Linux 22bf79c0c2301b6e15a688220284b147774d277e, Linux 99af22cd34688cc0d535a1919e0bea4cbc6c1ea1

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

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

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

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

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

Linux \>= 1438d349d16b78d88f9e978a4a5496f078c8191b, \< febc0b5dbabda414565bdfaaaa59d26f787d5fe7; \>= 1438d349d16b78d88f9e978a4a5496f078c8191b, \< 22bf79c0c2301b6e15a688220284b147774d277e; \>= 1438d349d16b78d88f9e978a4a5496f078c8191b, \< 99af22cd34688cc0d535a1919e0bea4cbc6c1ea1; Linux 6.10.

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

Yes. Fixed in Linux 22bf79c0c2301b6e15a688220284b147774d277e, Linux 99af22cd34688cc0d535a1919e0bea4cbc6c1ea1. Upgrade Linux to 99af22cd34688cc0d535a1919e0bea4cbc6c1ea1 or later.

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

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/febc0b5dbabda414565bdfaaaa59d26f787d5fe7>
- patch: <https://git.kernel.org/stable/c/22bf79c0c2301b6e15a688220284b147774d277e>
- patch: <https://git.kernel.org/stable/c/99af22cd34688cc0d535a1919e0bea4cbc6c1ea1>

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

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