Linux Kernel LoongArch Sleeping Function Call Vulnerability in Preemption Disabled Context

Vulnerability

A vulnerability exists in the Linux kernel on LoongArch architecture, where a sleeping function is called in a context that does not allow it, under certain debug configurations. This issue arises in the 'constant_clockevent_init' function, which improperly calls 'get_timer_irq()' multiple times. The misuse of 'might_sleep()' in a preemption-disabled context triggers a warning, indicating that the function could potentially sleep when it shouldn't, disrupting the expected execution flow.

Impact

The vulnerability can lead to improper handling of sleep functions, potentially causing deadlocks or other synchronization issues in the kernel.

Reproduction

The vulnerability can be reproduced by booting a LoongArch system with the 'CONFIG_DEBUG_ATOMIC_SLEEP' and 'CONFIG_DEBUG_PREEMPT' options enabled. This configuration will cause the kernel to issue warnings about sleeping functions being called from invalid contexts, particularly during the initialization of secondary CPUs.

Remediation

The vulnerability has been addressed in the Linux kernel by modifying the 'constant_clockevent_init' function to only call 'get_timer_irq()' once, using a check to ensure the timer IRQ has not already been retrieved.

Added: Jun 9, 2025, 7:46 PM
Updated: Jun 9, 2025, 7:46 PM

Vulnerability Rating

Custom Algorithm
spread
9.0
impact
0.6
exploitability
4.3
remediation
0.0
relevance
0.0
threat
4.8
urgency
2.9
incentive
1.7

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.