Fix indefinitely sleeping task in poll_schedule_timeout() in Kernel
Summary
GSD-2022-1000118: select: Fix indefinitely sleeping task in poll_schedule_timeout(). Affects Kernel versions < 6717900f775a6129a7b4d03ba4922218d8bf1caa. No fix is published. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The Kernel is a crucial component of the Linux operating system that acts as a bridge between the hardware and software layers. It provides essential functionalities such as process management, memory management, and device drivers. The vulnerability in question affects the Kernel's select function, specifically in the poll_schedule_timeout() function. This function is responsible for handling timeouts in the polling mechanism. The vulnerability allows a task to sleep indefinitely, leading to potential resource exhaustion and denial-of-service attacks.
Vulnerability Detail
The vulnerability arises from a flaw in the poll_schedule_timeout() function within the Kernel's select implementation. By exploiting this flaw, an attacker can cause a task to sleep indefinitely, consuming system resources and potentially leading to a denial-of-service condition. The impact of this vulnerability can vary depending on the context in which the affected function is used. However, in worst-case scenarios, it can result in system instability and unresponsiveness. The vulnerability has been addressed in Linux Kernel version v4.19.227 by commit 6717900f775a6129a7b4d03ba4922218d8bf1caa.
How To Fix
No fixed version is published for this vulnerability.
Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →
Workaround
As a workaround, users can apply the patch provided in the commit 6717900f775a6129a7b4d03ba4922218d8bf1caa manually. The patch modifies the poll_schedule_timeout() function to prevent tasks from sleeping indefinitely. Here is the code snippet for the patch:
--- a/kernel/select.c
+++ b/kernel/select.c
@@ -123,7 +123,7 @@ static long poll_schedule_timeout(struct poll_wqueues *pwq,
return 0;
}
- return schedule_timeout(timeout);
+ return schedule_timeout(max_t(long, timeout, 1));
}
static void poll_schedule(struct poll_wqueues *pwq, struct file *filp, poll_table *p)
To apply the patch, locate the select.c file in the Kernel source code and replace the corresponding lines with the modified code.
Conclusion
The vulnerability in the Kernel's select function, specifically in the poll_schedule_timeout() function, allows a task to sleep indefinitely, potentially leading to resource exhaustion and denial-of-service attacks. It has been addressed in Linux Kernel version v4.19.227 by commit 6717900f775a6129a7b4d03ba4922218d8bf1caa. To fix the vulnerability, it is crucial to update the Kernel to the recommended version or apply the provided patch. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for Kernel →
FAQ
The Kernel is a critical component of the Linux operating system that acts as a bridge between the hardware and software layers. It provides essential functionalities such as process management, memory management, and device drivers.
The select function in the Kernel is a system call that allows a program to monitor multiple file descriptors for various types of events, such as data availability or exceptional conditions.
poll_schedule_timeout() is a function within the Kernel's select implementation that handles timeouts in the polling mechanism. It determines the duration for which a task should sleep while waiting for events on file descriptors.
The vulnerability can lead to resource exhaustion and denial-of-service attacks. By causing a task to sleep indefinitely, system resources can be consumed, potentially resulting in system instability and unresponsiveness.
To mitigate this vulnerability, it is recommended to update the Linux Kernel to version v4.19.227 or later. Regularly updating the Kernel ensures that the latest security patches are applied.
Related vulnerabilities
Recent vulnerabilities recorded for Kernel.