Skip to main content

CVE-2025-21767: Vulnerability in Linux Linux

High
VulnerabilityCVE-2025-21767cvecve-2025-21767
Published: Thu Feb 27 2025 (02/27/2025, 02:18:17 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: clocksource: Use migrate_disable() to avoid calling get_random_u32() in atomic context The following bug report happened with a PREEMPT_RT kernel: BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 2012, name: kwatchdog preempt_count: 1, expected: 0 RCU nest depth: 0, expected: 0 get_random_u32+0x4f/0x110 clocksource_verify_choose_cpus+0xab/0x1a0 clocksource_verify_percpu.part.0+0x6b/0x330 clocksource_watchdog_kthread+0x193/0x1a0 It is due to the fact that clocksource_verify_choose_cpus() is invoked with preemption disabled. This function invokes get_random_u32() to obtain random numbers for choosing CPUs. The batched_entropy_32 local lock and/or the base_crng.lock spinlock in driver/char/random.c will be acquired during the call. In PREEMPT_RT kernel, they are both sleeping locks and so cannot be acquired in atomic context. Fix this problem by using migrate_disable() to allow smp_processor_id() to be reliably used without introducing atomic context. preempt_disable() is then called after clocksource_verify_choose_cpus() but before the clocksource measurement is being run to avoid introducing unexpected latency.

AI-Powered Analysis

AILast updated: 06/27/2025, 23:41:08 UTC

Technical Analysis

CVE-2025-21767 is a vulnerability identified in the Linux kernel, specifically affecting the clocksource subsystem when running with the PREEMPT_RT patch, which is used to provide real-time capabilities. The issue arises because the function clocksource_verify_choose_cpus() is called with preemption disabled (atomic context), but it internally calls get_random_u32() to obtain random numbers. This function acquires locks (batched_entropy_32 local lock and base_crng.lock spinlock) that are implemented as sleeping locks in the PREEMPT_RT kernel. Sleeping locks cannot be acquired in atomic context, leading to a kernel BUG due to a sleeping function being called from an invalid context. This results in kernel panics or system instability. The root cause is that get_random_u32() attempts to acquire locks that may sleep, which is not allowed in atomic context. The fix involves using migrate_disable() to safely call smp_processor_id() without entering atomic context, and then disabling preemption after clocksource_verify_choose_cpus() returns but before clocksource measurement begins. This avoids introducing unexpected latency while preventing the invalid sleeping lock acquisition. This vulnerability is significant in environments using the PREEMPT_RT kernel, which is common in real-time systems requiring deterministic behavior, such as industrial control systems, telecommunications, and embedded devices. The bug manifests as kernel crashes or instability, potentially leading to denial of service. There are no known exploits in the wild yet, and no CVSS score has been assigned at the time of publication.

Potential Impact

For European organizations, the impact of CVE-2025-21767 primarily concerns systems running Linux kernels with the PREEMPT_RT patch, which are often deployed in real-time and embedded environments. This includes critical infrastructure sectors such as manufacturing automation, energy grid management, telecommunications, and transportation systems. Kernel crashes or instability caused by this vulnerability can lead to system downtime, disruption of real-time operations, and potential safety risks in industrial environments. Confidentiality and integrity impacts are minimal since the vulnerability does not directly enable privilege escalation or data leakage. However, availability is significantly affected due to potential kernel panics and system crashes. Organizations relying on real-time Linux systems for critical operations may face operational disruptions and financial losses. Additionally, recovery from kernel crashes in embedded or industrial systems can be complex and time-consuming, increasing downtime. Given the lack of known exploits, the immediate risk is moderate, but the vulnerability should be addressed promptly to maintain system stability and reliability in critical real-time applications.

Mitigation Recommendations

1. Apply the official Linux kernel patches that address CVE-2025-21767 as soon as they become available. Monitor Linux kernel mailing lists and vendor advisories for updates. 2. For organizations using PREEMPT_RT kernels, ensure that kernel versions are updated to include the fix, especially in production real-time systems. 3. Conduct thorough testing of updated kernels in staging environments to verify stability and performance before deployment. 4. Implement robust monitoring for kernel panics and system crashes to detect potential exploitation or instability early. 5. Where possible, isolate real-time systems from general-purpose networks to reduce exposure. 6. For embedded devices, coordinate with hardware and software vendors to obtain patched firmware or kernel updates. 7. Review system configurations to minimize unnecessary use of PREEMPT_RT if real-time capabilities are not strictly required, reducing attack surface. 8. Maintain comprehensive backup and recovery procedures to quickly restore systems in case of failure.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-12-29T08:45:45.762Z
Cisa Enriched
false
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9820c4522896dcbdd334

Added to database: 5/21/2025, 9:08:48 AM

Last enriched: 6/27/2025, 11:41:08 PM

Last updated: 8/12/2025, 10:28:41 AM

Views: 9

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats