CVE-2025-38335: Input: gpio-keys - fix a sleep while atomic with PREEMPT_RT
In the Linux kernel, the following vulnerability has been resolved:
Input: gpio-keys - fix a sleep while atomic with PREEMPTRT
When enabling PREEMPTRT, the gpiokeysirqtimer() callback runs in hard irq context, but the inputevent() takes a spinlock, which isn't allowed there as it is converted to a rtspinlock().
[ 4054.289999] BUG: sleeping function called from invalid context at kernel/locking/spinlockrt.c:48 [ 4054.290028] inatomic(): 1, irqsdisabled(): 1, nonblock: 0, pid: 0, name: swapper/0 ... [ 4054.290195] mightresched+0x13c/0x1f4 [ 4054.290209] rtspinlock+0x54/0x11c [ 4054.290219] inputevent+0x48/0x80 [ 4054.290230] gpiokeysirqtimer+0x4c/0x78 [ 4054.290243] hrtimerrunqueues+0x1a4/0x438 [ 4054.290257] hrtimerinterrupt+0xe4/0x240 [ 4054.290269] archtimerhandlerphys+0x2c/0x44 [ 4054.290283] handlepercpudevidirq+0x8c/0x14c [ 4054.290297] handleirqdesc+0x40/0x58 [ 4054.290307] generichandledomainirq+0x1c/0x28 [ 4054.290316] gichandleirq+0x44/0xcc
Considering the gpiokeysirqisr() can run in any context, e.g. it can be threaded, it seems there's no point in requesting the timer isr to run in hard irq context.
Relax the hrtimer not to use the hard context.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.1.176-1Fixed in 6.1.190-1Fixed in 6.12.107-1Fixed in 6.12.113-1Fixed in 7.2.12-1Fixed in 7.2.13-1 - Configuration
Relax the hrtimer so gpio_keys_irq_timer() does not run in hard IRQ context; allow the timer ISR to be threaded.
Linux kernel Input: gpio-keys gpio_keys_irq_timer() hrtimer execution context = threaded/non-hard context
Event History
Frequently Asked Questions
What is the severity of CVE-2025-38335?
CVE-2025-38335 has moderate severity due to its impact on systems using the PREEMPT_RT feature in the Linux kernel.
How do I fix CVE-2025-38335?
To fix CVE-2025-38335, update your Linux kernel to the latest stable version that addresses this vulnerability.
Which versions of the Linux kernel are affected by CVE-2025-38335?
CVE-2025-38335 affects Linux kernel versions prior to the fixes included in later updates.
What are the implications of CVE-2025-38335 for users?
Users may experience system instability or unexpected behavior when using the gpio_keys_irq_timer() callback with PREEMPT_RT enabled.
Where can I find more information about CVE-2025-38335?
Detailed information regarding CVE-2025-38335 is documented in the Linux kernel changelogs and security advisories.