CVE-2024-57885: Vulnerability in Linux Linux
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.
AI Analysis
Technical Summary
CVE-2024-57885 is a vulnerability identified in the Linux kernel related to the kernel memory leak detector (kmemleak) subsystem, specifically when the system is configured with the real-time preemption patch (CONFIG_PREEMPT_RT=y), SELinux as the Linux Security Module (LSM), and the kernel pointer restriction (kptr_restrict) set to 1. The issue manifests as a "sleeping function called from invalid context" warning triggered when reading the /sys/kernel/debug/kmemleak interface under certain conditions, such as when the kmemleak buffer contains at least one item. This warning arises because the kernel attempts to perform a privilege check (%pK format specifier) that requires sleeping in an atomic context where sleeping is disallowed, particularly under RT_PREEMPT kernels. The problem is rooted in the interaction between the SELinux LSM's CAP_SYSLOG privilege check and the real-time kernel's strict atomic context enforcement. The kernel trace shows multiple locks held and preemption disabled, which leads to the invalid context warning. The vulnerability does not cause direct memory corruption or data leakage but results in kernel warnings and potential instability or crashes due to improper context usage. The fix involves avoiding the unnecessary privilege check that triggers the sleeping function call, thereby eliminating the warning without losing diagnostic information. This fix improves kernel stability and correctness in real-time environments with SELinux enabled and kptr_restrict set, ensuring that kmemleak debug output can be safely accessed without causing kernel faults or warnings.
Potential Impact
For European organizations, especially those relying on Linux systems with real-time kernel patches and SELinux enabled for enhanced security, this vulnerability can lead to kernel instability or crashes when accessing kmemleak debug information. While it does not directly expose sensitive data or allow privilege escalation, the kernel warnings and potential faults can disrupt system monitoring, debugging, and maintenance activities. This is particularly relevant for industries requiring real-time processing and high availability, such as telecommunications, industrial control systems, automotive, and critical infrastructure sectors prevalent in Europe. The inability to safely use kmemleak debugging tools could hinder vulnerability detection and memory leak analysis, indirectly affecting system reliability and security posture. Additionally, kernel instability in production environments can lead to service interruptions, impacting business continuity and compliance with stringent European regulations on operational resilience and cybersecurity.
Mitigation Recommendations
European organizations should apply the official Linux kernel patches that address CVE-2024-57885 as soon as they become available, ensuring their real-time kernels are updated to versions including this fix. System administrators should verify kernel configurations, particularly the use of CONFIG_PREEMPT_RT, SELinux as the active LSM, and kptr_restrict settings, to understand exposure. Until patched, avoid accessing /sys/kernel/debug/kmemleak on affected systems or perform such operations during maintenance windows to minimize risk of kernel warnings or crashes. Organizations should also review their logging and monitoring configurations to detect any kernel warnings related to this issue. For environments requiring real-time performance and SELinux, consider testing kernel updates in staging environments to validate stability. Additionally, maintain robust backup and recovery procedures to mitigate potential disruptions. Collaboration with Linux distribution vendors to receive timely updates and security advisories is recommended to ensure rapid deployment of fixes.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland, Norway, Denmark
CVE-2024-57885: Vulnerability in Linux Linux
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.
AI-Powered Analysis
Technical Analysis
CVE-2024-57885 is a vulnerability identified in the Linux kernel related to the kernel memory leak detector (kmemleak) subsystem, specifically when the system is configured with the real-time preemption patch (CONFIG_PREEMPT_RT=y), SELinux as the Linux Security Module (LSM), and the kernel pointer restriction (kptr_restrict) set to 1. The issue manifests as a "sleeping function called from invalid context" warning triggered when reading the /sys/kernel/debug/kmemleak interface under certain conditions, such as when the kmemleak buffer contains at least one item. This warning arises because the kernel attempts to perform a privilege check (%pK format specifier) that requires sleeping in an atomic context where sleeping is disallowed, particularly under RT_PREEMPT kernels. The problem is rooted in the interaction between the SELinux LSM's CAP_SYSLOG privilege check and the real-time kernel's strict atomic context enforcement. The kernel trace shows multiple locks held and preemption disabled, which leads to the invalid context warning. The vulnerability does not cause direct memory corruption or data leakage but results in kernel warnings and potential instability or crashes due to improper context usage. The fix involves avoiding the unnecessary privilege check that triggers the sleeping function call, thereby eliminating the warning without losing diagnostic information. This fix improves kernel stability and correctness in real-time environments with SELinux enabled and kptr_restrict set, ensuring that kmemleak debug output can be safely accessed without causing kernel faults or warnings.
Potential Impact
For European organizations, especially those relying on Linux systems with real-time kernel patches and SELinux enabled for enhanced security, this vulnerability can lead to kernel instability or crashes when accessing kmemleak debug information. While it does not directly expose sensitive data or allow privilege escalation, the kernel warnings and potential faults can disrupt system monitoring, debugging, and maintenance activities. This is particularly relevant for industries requiring real-time processing and high availability, such as telecommunications, industrial control systems, automotive, and critical infrastructure sectors prevalent in Europe. The inability to safely use kmemleak debugging tools could hinder vulnerability detection and memory leak analysis, indirectly affecting system reliability and security posture. Additionally, kernel instability in production environments can lead to service interruptions, impacting business continuity and compliance with stringent European regulations on operational resilience and cybersecurity.
Mitigation Recommendations
European organizations should apply the official Linux kernel patches that address CVE-2024-57885 as soon as they become available, ensuring their real-time kernels are updated to versions including this fix. System administrators should verify kernel configurations, particularly the use of CONFIG_PREEMPT_RT, SELinux as the active LSM, and kptr_restrict settings, to understand exposure. Until patched, avoid accessing /sys/kernel/debug/kmemleak on affected systems or perform such operations during maintenance windows to minimize risk of kernel warnings or crashes. Organizations should also review their logging and monitoring configurations to detect any kernel warnings related to this issue. For environments requiring real-time performance and SELinux, consider testing kernel updates in staging environments to validate stability. Additionally, maintain robust backup and recovery procedures to mitigate potential disruptions. Collaboration with Linux distribution vendors to receive timely updates and security advisories is recommended to ensure rapid deployment of fixes.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- Linux
- Date Reserved
- 2025-01-11T14:45:42.026Z
- Cisa Enriched
- false
- Cvss Version
- null
- State
- PUBLISHED
Threat ID: 682d9822c4522896dcbde973
Added to database: 5/21/2025, 9:08:50 AM
Last enriched: 6/28/2025, 8:40:26 AM
Last updated: 8/7/2025, 12:19:35 AM
Views: 19
Related Threats
CVE-2025-9109: Observable Response Discrepancy in Portabilis i-Diario
MediumCVE-2025-9108: Improper Restriction of Rendered UI Layers in Portabilis i-Diario
MediumCVE-2025-9107: Cross Site Scripting in Portabilis i-Diario
MediumCVE-2025-9106: Cross Site Scripting in Portabilis i-Diario
MediumCVE-2025-9105: Cross Site Scripting in Portabilis i-Diario
MediumActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
External Links
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.