Skip to content
Heist/ feed
Back to feed
HighFix available

bpf: Check the validity of nr_words in bpf_iter_bits_new()

Type: advisorySources: OSV

In the Linux kernel, the following vulnerability has been resolved: bpf: Check the validity of nr_words in bpf_iter_bits_new() Check the validity of nr_words in bpf_iter_bits_new(). Without this check, when multiplication overflow occurs for nr_bits (e.g., when nr_words = 0x0400-0001, nr_bits becomes 64), stack corruption may occur due to bpf_probe_read_kernel_common(..., nr_bytes = 0x2000-0008). Fix it by limiting the maximum value of nr_words to 511. The value is derived from the current implementation of BPF memory allocator. To ensure compatibility if the BPF memory allocator's size limitation changes in the future, use the helper bpf_mem_alloc_check_size() to check whether nr_bytes is too larger. And return -E2BIG instead of -ENOMEM for oversized nr_bytes.

Products
Kernel
Affected versions
Not specified
Fixed versions
6.11.7
CVEs
CVE-2024-50253
Confirmed fixed CVEs
Not specified
Updated in this feed
5 Nov 2026, 17:54 UTC · Revision 1

Source evidence

bpf: Check the validity of nr_words in bpf_iter_bits_new()

core-osv · Original source

Published 9 Nov 2024, 10:15 UTC

In the Linux kernel, the following vulnerability has been resolved: bpf: Check the validity of nr_words in bpf_iter_bits_new() Check the validity of nr_words in bpf_iter_bits_new(). Without this check, when multiplication overflow occurs for nr_bits (e.g., when nr_words = 0x0400-0001, nr_bits becomes 64), stack corruption may occur due to bpf_probe_read_kernel_common(..., nr_bytes = 0x2000-0008). Fix it by limiting the maximum value of nr_words to 511. The value is derived from the current implementation of BPF memory allocator. To ensure compatibility if the BPF memory allocator's size limitation changes in the future, use the helper bpf_mem_alloc_check_size() to check whether nr_bytes is too larger. And return -E2BIG instead of -ENOMEM for oversized nr_bytes.

osv:CVE-2024-50253

Kernel

Fixed versions: 6.11.7

Complete source record
{
  "id": "4cf061c4b363d2f9c80cf94a73743dc4c8d80c67404447898bc30f0b9a3b7452",
  "url": "https://osv.dev/vulnerability/CVE-2024-50253",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "bpf: Check the validity of nr_words in bpf_iter_bits_new()",
    "summary": "In the Linux kernel, the following vulnerability has been resolved: bpf: Check the validity of nr_words in bpf_iter_bits_new() Check the validity of nr_words in bpf_iter_bits_new(). Without this check, when multiplication overflow occurs for nr_bits (e.g., when nr_words = 0x0400-0001, nr_bits becomes 64), stack corruption may occur due to bpf_probe_read_kernel_common(..., nr_bytes = 0x2000-0008). Fix it by limiting the maximum value of nr_words to 511. The value is derived from the current implementation of BPF memory allocator. To ensure compatibility if the BPF memory allocator's size limitation changes in the future, use the helper bpf_mem_alloc_check_size() to check whether nr_bytes is too larger. And return -E2BIG instead of -ENOMEM for oversized nr_bytes.",
    "evidence": "osv:CVE-2024-50253",
    "products": [
      {
        "name": {
          "value": "Kernel",
          "evidence": "/affected/1/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "6.11.7",
            "evidence": "/affected/1/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "high",
    "structured": {
      "id": "CVE-2024-50253",
      "aliases": [
        "CVE-2024-50253"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
              "type": "GIT",
              "events": [
                {
                  "introduced": "4665415975b0827e9646cab91c61d02a6b364d59"
                },
                {
                  "fixed": "c9539e09c67880ecd88b51188c346a2cc078b06c"
                },
                {
                  "fixed": "393397fbdcad7396639d7077c33f86169184ba99"
                }
              ]
            }
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-50253.json"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "6.11.0"
                },
                {
                  "fixed": "6.11.7"
                }
              ]
            }
          ],
          "package": {
            "name": "Kernel",
            "ecosystem": "Linux"
          },
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-50253.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:44.909395800Z",
      "provider": "osv",
      "references": [
        "https://git.kernel.org/stable/c/393397fbdcad7396639d7077c33f86169184ba99",
        "https://git.kernel.org/stable/c/c9539e09c67880ecd88b51188c346a2cc078b06c",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/50xxx/CVE-2024-50253.json",
        "https://nvd.nist.gov/vuln/detail/CVE-2024-50253",
        "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
      ],
      "provider_metadata": {
        "cna_assigner": "Linux",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/50xxx/CVE-2024-50253.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2024-50253",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 512602,
  "published_at": "2024-11-09T10:15:06.891+00:00"
}