CVE-2026-90338: serial: amba-pl011: keep console clock enabled for atomic writes
In the Linux kernel, the following vulnerability has been resolved:
serial: amba-pl011: keep console clock enabled for atomic writes
pl011consolewriteatomic() runs from nbcon atomic context, where sleeping is not allowed. It calls clkenable(), which takes the common-clk enablelock. Under PREEMPTRT that is a sleeping lock: clkenablelock() first tries spintrylockirqsave(), but on contention falls back to spinlockirqsave(). Therefore, an atomic-context printk on an RT kernel with a clk-backed pl011 can trip:
BUG: sleeping function called from invalid context at spinlockrt.c:48 mightresched from rtspinlock rtspinlock from clkenablelock clkenablelock from clkenable clkenable from pl011consolewriteatomic ... from vprintkemit
This was found and reproduced on PREEMPTRT. Arm32 and arm64 DT SoCs are affected; arm64 SBSA/ACPI has no clk, so clkenable(NULL) short-circuits before the lock. In addition, writeatomic() may be invoked from NMI context and is documented to avoid locking. Removing clkenable() from the callback also avoids a potentially unsafe NMI acquisition of the common-clock enablelock.
An nbcon atomic-capable console must be printable from any context, so the clock cannot be gated between writes. Enable the clock while the console is available for output: use clkprepareenable() in pl011consolesetup(), release it via clkdisableunprepare() in the console .exit() callback, and drop the per-write clkenable()/clkdisable() pairs from writeatomic() and writethread().
When printk suspends consoles, drop the reference after uartsuspendport() stops console access and restore it before uartresumeport() -- but only if suspend actually marked the port suspended (a wake-capable tty stays running and must keep its clock), and keep it when consolesuspendenabled is false so noconsolesuspend works.
The active power cost of keeping the clock enabled is platform-dependent: none where the UART clock is a fixed always-on oscillator, real where it is a gateable clock branch, which then cannot be gated (nor possibly can its parent clocks) while the console is available for output. When serial core actually suspends the port, the reference is released so the clock provider can gate the clock tree.
Affected Software
Event History
Frequently Asked Questions
Which systems are realistically affected?
The issue was found and reproduced on PREEMPT_RT kernels using a clock-backed PL011 console on Arm32 or arm64 device-tree SoCs. arm64 SBSA/ACPI systems are not affected by this clock-lock path because they have no clock and clk_enable(NULL) returns before taking the lock.
What conditions trigger the failure?
An atomic-context printk must reach pl011_console_write_atomic() while the common-clock enable lock is contended on a PREEMPT_RT kernel. The callback can also run from NMI context, where taking the common-clock enable lock is unsafe.
What can be done if the fix cannot be applied immediately?
The provided data identifies PREEMPT_RT operation with a clock-backed PL011 console as the affected configuration. Avoiding that combination, where operationally feasible, removes the described trigger path.
How can I identify signs that a system has encountered this issue?
Affected systems may report a "BUG: sleeping function called from invalid context" during an atomic-context printk. The reported stack includes __might_resched, rt_spin_lock, clk_enable_lock, clk_enable, pl011_console_write_atomic, and vprintk_emit.