Vulnerability in Kernel: mm: Consider __GFP_NOWARN flag for oversized kvmalloc() calls
Summary
GSD-2022-1000835: mm: Consider __GFP_NOWARN flag for oversized kvmalloc() calls. Affects Kernel versions >= 57a269a1b12a3a6fe51f62e1be5e74494bad1d92, < e93f2be33d4f4c1aa350dd79b6d1179746ff4cb5. 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 critical component of the Linux operating system that manages system resources and facilitates communication between hardware and software. It provides essential functionalities such as memory management, process scheduling, and device drivers. The mm subsystem within the Kernel is responsible for memory management. One of its functions, kvmalloc(), is used to allocate memory for the Kernel's virtual machine subsystem. However, there is a vulnerability in the way kvmalloc() handles oversized allocations, which can lead to potential security issues.
Vulnerability Detail
The vulnerability arises from the lack of consideration for the __GFP_NOWARN flag in oversized kvmalloc() calls. This flag suppresses allocation warnings, which can be useful in certain scenarios. However, when oversized allocations are made without this flag, it can result in memory corruption or other security vulnerabilities. An attacker could potentially exploit this vulnerability to execute arbitrary code, escalate privileges, or cause a denial-of-service condition. The vulnerability was introduced in version v5.10.71 of the Linux Kernel and has been fixed in version v5.10.104.
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
If updating the Kernel is not immediately feasible, a temporary workaround can be implemented by manually adding the __GFP_NOWARN flag to oversized kvmalloc() calls in the affected code. Here is an example of how the flag can be added:
kvmalloc(size, GFP_KERNEL | __GFP_NOWARN);
Conclusion
The vulnerability in the Kernel's mm subsystem, specifically in the handling of oversized kvmalloc() calls, can lead to memory corruption and other security vulnerabilities. It is crucial to update the Linux Kernel to version v5.10.104 or later to fix this issue. In the meantime, a temporary workaround can be implemented by manually adding the __GFP_NOWARN flag to affected code. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for Kernel →
FAQ
The vulnerability can potentially allow an attacker to execute arbitrary code, escalate privileges, or cause a denial-of-service condition.
You can use the Vulert Playground at Vulert Scanner to check if your system is affected by this vulnerability. Simply upload your package-lock.json file, and Vulert will analyze it for any open-source vulnerabilities, including this one.
At the time of this report, there is no known public exploit for this vulnerability. However, it is still crucial to apply the necessary updates to mitigate the risk.
Yes, a temporary workaround is available by manually adding the __GFP_NOWARN flag to oversized kvmalloc() calls in the affected code. However, it is strongly recommended to update the Kernel as soon as possible.
There may be other vulnerabilities in the Kernel that are unrelated to this specific issue. It is important to regularly update the Kernel and stay informed about security advisories to mitigate any potential risks.
Related vulnerabilities
Recent vulnerabilities recorded for Kernel.