CVE-2025-21767
clocksource: Use migrate_disable() to avoid calling get_random_u32() in atomic context
Reported by linux · Published February 27, 2025
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.
Fixed versions
Upgrade to a fixed version or later. Language registries are listed first, then Linux distributions, then vendor products.
| Package | Ecosystem | Fixed in |
|---|---|---|
| kernel-livepatch-6.1.129-138.220 | Amazon Linux | 1.0-0.amzn2023 |
| kernel-modules-extra-common | Amazon Linux | 6.1.129-138.220.amzn2023 |
| bpftool | Amazon Linux | 6.1.129-138.220.amzn2023 |
| kernel-tools | Amazon Linux | 6.1.129-138.220.amzn2023 |
| kernel-headers | Amazon Linux | 6.1.129-138.220.amzn2023 |
| kernel-libbpf-devel | Amazon Linux | 6.1.129-138.220.amzn2023 |
| linux_kernel | linux | 6.13.4, 6.12.16, 6.6.79, 6.1.129, 5.15.179, 5.13, 5.10.235 |
Affected products
| Vendor | Product | Versions |
|---|---|---|
| Linux | Linux | d9b40ebd448e437ffbc65f013836f98252279a82, 7560c02bdffb7c52d1457fa551b9e745d4b9e754, 7560c02bdffb7c52d1457fa551b9e745d4b9e754 |
| Linux | Linux | 5.14, 0, 5.10.235 |
| amazon:2023 | kernel-livepatch-6.1.129-138.220 | 0 |
| Siemens | SIPLUS S7-1500 CPU 1518-4 PN/DP MFP | 3.1.5 |
| amazon:2023 | kernel-modules-extra-common | 0 |
| amazon:2023 | bpftool | 0 |
| amazon:2023 | kernel-tools | 0 |
| amazon:2023 | kernel-headers | 0 |
| amazon:2023 | kernel-libbpf-devel | 0 |
| Siemens | SIMATIC S7-1500 TM MFP - GNU/Linux subsystem | 0 |
| linux | linux_kernel | 5.10.50, 5.14, 5.14 |
| amazon:2023 | kernel-tools-devel | 0 |
| amazon:2023 | kernel-libbpf-static | 0 |
| Siemens | SIMATIC S7-1500 CPU 1518-4 PN/DP MFP | 3.1.5 |
| amazon:2023 | perf | 0 |
| Siemens | SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP | 3.1.5 |
| amazon:2023 | kernel | 0 |
| amazon:2023 | kernel-devel | 0 |
| amazon:2023 | python3-perf | 0 |
| amazon:2023 | kernel-libbpf | 0 |
…and 2 more
Timeline
- Feb 26, 2025 CVE Published
- Feb 27, 2025 EPSS Score (30 in total, the first dated here)
- Feb 28, 2025 Coalition ESS Score (13 in total, the first dated here)
- Dec 18, 2025 PoC Published
- Dec 22, 2025 Security Advisory (392 in total, the first dated here)
- Apr 29, 2026 Distribution Patch (345 in total, the first dated here)
- Nov 11, 2026 CVE Updated
Query this with the API
The same record, from the CLI:
vulnetix vdb vuln CVE-2025-21767
vulnetix vdb fixes CVE-2025-21767
Or with curl, using the org id and key from your account page:
curl -s -H "Authorization: ApiKey ${VULNETIX_ORG_ID}:${VULNETIX_API_KEY}" \
"https://api.vdb.vulnetix.com/v2/vuln/CVE-2025-21767/fixes/registry"
The Community plan is free and allows 50 queries a day. Get a free API key · API quickstart