CVE-2025-21767: clocksource: Use migrate_disable() to avoid calling get_random_u32() in atomic context

Published Feb 27, 2025
·
Updated

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

clocksource: Use migratedisable() to avoid calling getrandomu32() in atomic context

The following bug report happened with a PREEMPTRT kernel:

BUG: sleeping function called from invalid context at kernel/locking/spinlockrt.c:48 inatomic(): 1, irqsdisabled(): 0, nonblock: 0, pid: 2012, name: kwatchdog preemptcount: 1, expected: 0 RCU nest depth: 0, expected: 0 getrandomu32+0x4f/0x110 clocksourceverifychoosecpus+0xab/0x1a0 clocksourceverifypercpu.part.0+0x6b/0x330 clocksourcewatchdogkthread+0x193/0x1a0

It is due to the fact that clocksourceverifychoosecpus() is invoked with preemption disabled. This function invokes getrandomu32() to obtain random numbers for choosing CPUs. The batchedentropy32 local lock and/or the basecrng.lock spinlock in driver/char/random.c will be acquired during the call. In PREEMPTRT kernel, they are both sleeping locks and so cannot be acquired in atomic context.

Fix this problem by using migratedisable() to allow smpprocessorid() to be reliably used without introducing atomic context. preemptdisable() is then called after clocksourceverifychoosecpus() but before the clocksource measurement is being run to avoid introducing unexpected latency.

Affected Software

9 affected components
Linux Linux kernel
Linux Linux kernel>=5.10.50<5.10.235
Linux Linux kernel>=5.12.17<5.13
Linux Linux kernel>=5.13.2<5.15.179
Linux Linux kernel>=5.16<6.1.129
Linux Linux kernel>=6.2<6.6.79
Linux Linux kernel>=6.7<6.12.16
Linux Linux kernel>=6.13<6.13.4
Linux Linux kernel=6.14-rc1

Event History

Feb 27, 2025
CVE Published
via MITRE·02:18 AM
Data Sourced
via MITRE·02:18 AM
Description
Data Sourced
via NVD·03:15 AM
RemedyDescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2025-21767?

CVE-2025-21767 is considered to have a medium severity level due to its potential impact on system stability.

2

How do I fix CVE-2025-21767?

To fix CVE-2025-21767, update your Linux kernel to the latest version where the vulnerability has been patched.

3

What systems are affected by CVE-2025-21767?

CVE-2025-21767 affects various versions of the Linux kernel, particularly in PREEMPT_RT configurations.

4

Can CVE-2025-21767 lead to system crashes?

Yes, CVE-2025-21767 can potentially lead to system crashes if the vulnerable conditions are exploited.

5

What conditions trigger CVE-2025-21767?

CVE-2025-21767 is triggered when sleeping functions are called from an invalid atomic context in the Linux kernel.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203