# CVE-2024-57885: mm/kmemleak: fix sleeping function called from invalid context at print message

> 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.30% (percentile 15, 2026-11-28)
- **CWE:** CWE-401
- **Published:** 2025-01-15T13:05:38.261Z
- **Modified:** 2026-06-17T08:14:08.797Z

## Who should check

- Anyone running Linux \>= 3a6f33d86baa8103c80f62edd9393e9f7bf25d72, \< 86d946f3f9992aaa12abcfd09f925446c2cd42a2; \>= 3a6f33d86baa8103c80f62edd9393e9f7bf25d72, \< 64b2d32f22597b2a1dc83ac600b2426588851a97; \>= 3a6f33d86baa8103c80f62edd9393e9f7bf25d72, \< cddc76b165161a02ff14c4d84d0f5266d9d32b9e
- Anyone running Linux 6.2

## Description

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

mm/kmemleak: fix sleeping function called from invalid context at print message

Address a bug in the kernel that triggers a "sleeping function called from
invalid context" warning when /sys/kernel/debug/kmemleak is printed under
specific conditions:
- CONFIG\_PREEMPT\_RT=y
- Set SELinux as the LSM for the system
- Set kptr\_restrict to 1
- kmemleak buffer contains at least one item

BUG: sleeping function called from invalid context at kernel/locking/spinlock\_rt.c:48
in\_atomic(): 1, irqs\_disabled(): 1, non\_block: 0, pid: 136, name: cat
preempt\_count: 1, expected: 0
RCU nest depth: 2, expected: 2
6 locks held by cat/136:
 \#0: ffff32e64bcbf950 (&p-\>lock){+.+.}-{3:3}, at: seq\_read\_iter+0xb8/0xe30
 \#1: ffffafe6aaa9dea0 (scan\_mutex){+.+.}-{3:3}, at: kmemleak\_seq\_start+0x34/0x128
 \#3: ffff32e6546b1cd0 (&object-\>lock){....}-{2:2}, at: kmemleak\_seq\_show+0x3c/0x1e0
 \#4: ffffafe6aa8d8560 (rcu\_read\_lock){....}-{1:2}, at: has\_ns\_capability\_noaudit+0x8/0x1b0
 \#5: ffffafe6aabbc0f8 (notif\_lock){+.+.}-{2:2}, at: avc\_compute\_av+0xc4/0x3d0
irq event stamp: 136660
hardirqs last  enabled at (136659): \[\<ffffafe6a80fd7a0\>\] \_raw\_spin\_unlock\_irqrestore+0xa8/0xd8
hardirqs last disabled at (136660): \[\<ffffafe6a80fd85c\>\] \_raw\_spin\_lock\_irqsave+0x8c/0xb0
softirqs last  enabled at (0): \[\<ffffafe6a5d50b28\>\] copy\_process+0x11d8/0x3df8
softirqs last disabled at (0): \[\<0000000000000000\>\] 0x0
Preemption disabled at:
\[\<ffffafe6a6598a4c\>\] kmemleak\_seq\_show+0x3c/0x1e0
CPU: 1 UID: 0 PID: 136 Comm: cat Tainted: G            E      6.11.0-rt7+ \#34
Tainted: \[E\]=UNSIGNED\_MODULE
Hardware name: linux,dummy-virt (DT)
Call trace:
 dump\_backtrace+0xa0/0x128
 show\_stack+0x1c/0x30
 dump\_stack\_lvl+0xe8/0x198
 dump\_stack+0x18/0x20
 rt\_spin\_lock+0x8c/0x1a8
 avc\_perm\_nonode+0xa0/0x150
 cred\_has\_capability.isra.0+0x118/0x218
 selinux\_capable+0x50/0x80
 security\_capable+0x7c/0xd0
 has\_ns\_capability\_noaudit+0x94/0x1b0
 has\_capability\_noaudit+0x20/0x30
 restricted\_pointer+0x21c/0x4b0
 pointer+0x298/0x760
 vsnprintf+0x330/0xf70
 seq\_printf+0x178/0x218
 print\_unreferenced+0x1a4/0x2d0
 kmemleak\_seq\_show+0xd0/0x1e0
 seq\_read\_iter+0x354/0xe30
 seq\_read+0x250/0x378
 full\_proxy\_read+0xd8/0x148
 vfs\_read+0x190/0x918
 ksys\_read+0xf0/0x1e0
 \_\_arm64\_sys\_read+0x70/0xa8
 invoke\_syscall.constprop.0+0xd4/0x1d8
 el0\_svc+0x50/0x158
 el0t\_64\_sync+0x17c/0x180

%pS and %pK, in the same back trace line, are redundant, and %pS can void
%pK service in certain contexts.

%pS alone already provides the necessary information, and if it cannot
resolve the symbol, it falls back to printing the raw address voiding
the original intent behind the %pK.

Additionally, %pK requires a privilege check CAP\_SYSLOG enforced through
the LSM, which can trigger a "sleeping function called from invalid
context" warning under RT\_PREEMPT kernels when the check occurs in an
atomic context. This issue may also affect other LSMs.

This change avoids the unnecessary privilege check and resolves the
sleeping function warning without any loss of information.

## Affected and fixed versions

- Linux: \>= 3a6f33d86baa8103c80f62edd9393e9f7bf25d72, \< 86d946f3f9992aaa12abcfd09f925446c2cd42a2; \>= 3a6f33d86baa8103c80f62edd9393e9f7bf25d72, \< 64b2d32f22597b2a1dc83ac600b2426588851a97; \>= 3a6f33d86baa8103c80f62edd9393e9f7bf25d72, \< cddc76b165161a02ff14c4d84d0f5266d9d32b9e (cvelist)
- Linux: 6.2 (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-2024-57885. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-57885.md
Affected: Linux >= 3a6f33d86baa8103c80f62edd9393e9f7bf25d72, < 86d946f3f9992aaa12abcfd09f925446c2cd42a2; >= 3a6f33d86baa8103c80f62edd9393e9f7bf25d72, < 64b2d32f22597b2a1dc83ac600b2426588851a97; >= 3a6f33d86baa8103c80f62edd9393e9f7bf25d72, < cddc76b165161a02ff14c4d84d0f5266d9d32b9e; Linux 6.2
Fixed in: Linux 86d946f3f9992aaa12abcfd09f925446c2cd42a2, Linux 64b2d32f22597b2a1dc83ac600b2426588851a97

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-2024-57885 being exploited?

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

### How serious is CVE-2024-57885?

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

### Which versions are affected by CVE-2024-57885?

Linux \>= 3a6f33d86baa8103c80f62edd9393e9f7bf25d72, \< 86d946f3f9992aaa12abcfd09f925446c2cd42a2; \>= 3a6f33d86baa8103c80f62edd9393e9f7bf25d72, \< 64b2d32f22597b2a1dc83ac600b2426588851a97; \>= 3a6f33d86baa8103c80f62edd9393e9f7bf25d72, \< cddc76b165161a02ff14c4d84d0f5266d9d32b9e; Linux 6.2.

### Is there a fix for CVE-2024-57885?

Yes. Fixed in Linux 86d946f3f9992aaa12abcfd09f925446c2cd42a2, Linux 64b2d32f22597b2a1dc83ac600b2426588851a97. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2024-57885?

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/86d946f3f9992aaa12abcfd09f925446c2cd42a2>
- patch: <https://git.kernel.org/stable/c/64b2d32f22597b2a1dc83ac600b2426588851a97>
- patch: <https://git.kernel.org/stable/c/cddc76b165161a02ff14c4d84d0f5266d9d32b9e>

## 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-2024-57885>

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