Excessive Memory Allocation in bpf: Fix in Linux Kernel

Kernel Updated 02 Oct 2025

Summary

28/06/2022
N/A
No i
Unrated
Not published

GSD-2022-1003811: bpf: Fix excessive memory allocation in stack_map_alloc(). Affects Kernel versions >= b936ca643ade11f265fa10e5fb71c20d9c5243f1, < 93c0f9d78dddd3e60062b83715e5fabd2692d6a0. No fix is published. How to fix ↓

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

The Linux Kernel is a critical component of the Linux operating system, responsible for managing system resources and providing an interface between hardware and software. It includes various subsystems, one of which is the Berkeley Packet Filter (BPF). BPF is a virtual machine in the kernel that allows user-defined programs to run in a safe and efficient manner. These programs are commonly used for network packet filtering and analysis.

The vulnerability in question, identified as GSD-2022-1003811, specifically affects the BPF subsystem. It involves an excessive memory allocation issue in the stack_map_alloc() function. This vulnerability was introduced in Linux Kernel version 5.3 and fixed in version 5.4.198.

The excessive memory allocation can lead to resource exhaustion, potentially resulting in denial-of-service (DoS) attacks or system instability. However, the actual impact and attack plausibility have not been proven yet.

Vulnerability Detail

The vulnerability arises from a flaw in the stack_map_alloc() function within the BPF subsystem. This function is responsible for allocating memory for stack maps, which are data structures used by BPF programs to store information about stack frames.

The issue occurs when the stack_map_alloc() function is called with a large size parameter. In such cases, the function may allocate more memory than necessary, leading to excessive memory consumption. This can be exploited by an attacker to exhaust system resources, potentially causing a denial-of-service condition or destabilizing the system.

The vulnerability was addressed in Linux Kernel version 5.4.198 by commit 93c0f9d78dddd3e60062b83715e5fabd2692d6a0.

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 a patch or backport the fix to their current kernel version. The specific steps for applying a patch may vary depending on the kernel version and distribution being used. It is recommended to consult the official documentation or community resources for detailed instructions on applying patches.

Here is an example of how to apply the fix using the patch provided in the Linux Kernel commit:

  1. Download the patch file from the Linux Kernel repository:

    • Patch file: [link to patch file]
  2. Navigate to the kernel source code directory:

    cd /path/to/kernel/source
    
  3. Apply the patch using the patch command:

    patch -p1 < /path/to/patch/file
    
  4. Recompile and reinstall the kernel as per the standard procedures for the target system.

It is important to note that applying patches or backporting fixes may introduce additional complexities and potential risks. Therefore, it is recommended to thoroughly test the patched kernel before deploying it in production environments.

Conclusion

The excessive memory allocation vulnerability in the BPF subsystem of the Linux Kernel (GSD-2022-1003811) can potentially lead to denial-of-service attacks or system instability. It is crucial to update the Linux Kernel to version 5.4.198 or later to mitigate this vulnerability. Users can also apply patches or backport the fix as a temporary workaround. It is recommended to thoroughly test any patched kernel before deploying it in production environments. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for Kernel →

Share this vulnerability

FAQ

The vulnerability can lead to excessive memory consumption, potentially resulting in denial-of-service (DoS) attacks or system instability. However, the actual impact and attack plausibility have not been proven yet.

The vulnerability was introduced in Linux Kernel version 5.3 and fixed in version 5.4.198. Therefore, versions between 5.3 and 5.4.197 (inclusive) are affected.

You can use vulnerability monitoring tools like Vulert to check if your system is affected by this vulnerability. Vulert uses a manifest file like package-lock.json to monitor and alert in real-time for open-source vulnerabilities in the software. You can visit the Vulert Playground at [https://vulert.com/scanner] to check if your application is affected without requiring any signup.

Yes, users can apply a patch or backport the fix to their current kernel version. However, it is recommended to update to the fixed version of the Linux Kernel (5.4.198 or later) as soon as possible.

You can find more information about this vulnerability, including the specific commit that fixed it, in the vulnerability database maintained by the Cloud Security Alliance. The reference link is provided in the vulnerability details.

Related vulnerabilities

Recent vulnerabilities recorded for Kernel.

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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback