CVE-2025-68211 (GCVE-0-2025-68211)
Vulnerability from cvelistv5
Published
2025-12-16 13:48
Modified
2025-12-16 13:48
Severity ?
Summary
In the Linux kernel, the following vulnerability has been resolved: ksm: use range-walk function to jump over holes in scan_get_next_rmap_item Currently, scan_get_next_rmap_item() walks every page address in a VMA to locate mergeable pages. This becomes highly inefficient when scanning large virtual memory areas that contain mostly unmapped regions, causing ksmd to use large amount of cpu without deduplicating much pages. This patch replaces the per-address lookup with a range walk using walk_page_range(). The range walker allows KSM to skip over entire unmapped holes in a VMA, avoiding unnecessary lookups. This problem was previously discussed in [1]. Consider the following test program which creates a 32 TiB mapping in the virtual address space but only populates a single page: #include <unistd.h> #include <stdio.h> #include <sys/mman.h> /* 32 TiB */ const size_t size = 32ul * 1024 * 1024 * 1024 * 1024; int main() { char *area = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_NORESERVE | MAP_PRIVATE | MAP_ANON, -1, 0); if (area == MAP_FAILED) { perror("mmap() failed\n"); return -1; } /* Populate a single page such that we get an anon_vma. */ *area = 0; /* Enable KSM. */ madvise(area, size, MADV_MERGEABLE); pause(); return 0; } $ ./ksm-sparse & $ echo 1 > /sys/kernel/mm/ksm/run Without this patch ksmd uses 100% of the cpu for a long time (more then 1 hour in my test machine) scanning all the 32 TiB virtual address space that contain only one mapped page. This makes ksmd essentially deadlocked not able to deduplicate anything of value. With this patch ksmd walks only the one mapped page and skips the rest of the 32 TiB virtual address space, making the scan fast using little cpu.
Impacted products
Vendor Product Version
Linux Linux Version: 31dbd01f314364b70c2e026a5793a29a4da8a9dc
Version: 31dbd01f314364b70c2e026a5793a29a4da8a9dc
Version: 31dbd01f314364b70c2e026a5793a29a4da8a9dc
Create a notification for this product.
Show details on NVD website


{
  "containers": {
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "mm/ksm.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "74f78421c925b6d17695566f0c5941de57fd44b3",
              "status": "affected",
              "version": "31dbd01f314364b70c2e026a5793a29a4da8a9dc",
              "versionType": "git"
            },
            {
              "lessThan": "f62973e0767e4fcd6799087787fca08ca2a85b8c",
              "status": "affected",
              "version": "31dbd01f314364b70c2e026a5793a29a4da8a9dc",
              "versionType": "git"
            },
            {
              "lessThan": "f5548c318d6520d4fa3c5ed6003eeb710763cbc5",
              "status": "affected",
              "version": "31dbd01f314364b70c2e026a5793a29a4da8a9dc",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "mm/ksm.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "2.6.32"
            },
            {
              "lessThan": "2.6.32",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.12.*",
              "status": "unaffected",
              "version": "6.12.59",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.17.*",
              "status": "unaffected",
              "version": "6.17.9",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.18",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "cpeApplicability": [
        {
          "nodes": [
            {
              "cpeMatch": [
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.12.59",
                  "versionStartIncluding": "2.6.32",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.17.9",
                  "versionStartIncluding": "2.6.32",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.18",
                  "versionStartIncluding": "2.6.32",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nksm: use range-walk function to jump over holes in scan_get_next_rmap_item\n\nCurrently, scan_get_next_rmap_item() walks every page address in a VMA to\nlocate mergeable pages.  This becomes highly inefficient when scanning\nlarge virtual memory areas that contain mostly unmapped regions, causing\nksmd to use large amount of cpu without deduplicating much pages.\n\nThis patch replaces the per-address lookup with a range walk using\nwalk_page_range().  The range walker allows KSM to skip over entire\nunmapped holes in a VMA, avoiding unnecessary lookups.  This problem was\npreviously discussed in [1].\n\nConsider the following test program which creates a 32 TiB mapping in the\nvirtual address space but only populates a single page:\n\n#include \u003cunistd.h\u003e\n#include \u003cstdio.h\u003e\n#include \u003csys/mman.h\u003e\n\n/* 32 TiB */\nconst size_t size = 32ul * 1024 * 1024 * 1024 * 1024;\n\nint main() {\n        char *area = mmap(NULL, size, PROT_READ | PROT_WRITE,\n                          MAP_NORESERVE | MAP_PRIVATE | MAP_ANON, -1, 0);\n\n        if (area == MAP_FAILED) {\n                perror(\"mmap() failed\\n\");\n                return -1;\n        }\n\n        /* Populate a single page such that we get an anon_vma. */\n        *area = 0;\n\n        /* Enable KSM. */\n        madvise(area, size, MADV_MERGEABLE);\n        pause();\n        return 0;\n}\n\n$ ./ksm-sparse  \u0026\n$ echo 1 \u003e /sys/kernel/mm/ksm/run \n\nWithout this patch ksmd uses 100% of the cpu for a long time (more then 1\nhour in my test machine) scanning all the 32 TiB virtual address space\nthat contain only one mapped page.  This makes ksmd essentially deadlocked\nnot able to deduplicate anything of value.  With this patch ksmd walks\nonly the one mapped page and skips the rest of the 32 TiB virtual address\nspace, making the scan fast using little cpu."
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2025-12-16T13:48:37.959Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/74f78421c925b6d17695566f0c5941de57fd44b3"
        },
        {
          "url": "https://git.kernel.org/stable/c/f62973e0767e4fcd6799087787fca08ca2a85b8c"
        },
        {
          "url": "https://git.kernel.org/stable/c/f5548c318d6520d4fa3c5ed6003eeb710763cbc5"
        }
      ],
      "title": "ksm: use range-walk function to jump over holes in scan_get_next_rmap_item",
      "x_generator": {
        "engine": "bippy-1.2.0"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2025-68211",
    "datePublished": "2025-12-16T13:48:37.959Z",
    "dateReserved": "2025-12-16T13:41:40.256Z",
    "dateUpdated": "2025-12-16T13:48:37.959Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2",
  "vulnerability-lookup:meta": {
    "nvd": "{\"cve\":{\"id\":\"CVE-2025-68211\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2025-12-16T14:15:54.023\",\"lastModified\":\"2025-12-18T15:08:25.907\",\"vulnStatus\":\"Awaiting Analysis\",\"cveTags\":[],\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\nksm: use range-walk function to jump over holes in scan_get_next_rmap_item\\n\\nCurrently, scan_get_next_rmap_item() walks every page address in a VMA to\\nlocate mergeable pages.  This becomes highly inefficient when scanning\\nlarge virtual memory areas that contain mostly unmapped regions, causing\\nksmd to use large amount of cpu without deduplicating much pages.\\n\\nThis patch replaces the per-address lookup with a range walk using\\nwalk_page_range().  The range walker allows KSM to skip over entire\\nunmapped holes in a VMA, avoiding unnecessary lookups.  This problem was\\npreviously discussed in [1].\\n\\nConsider the following test program which creates a 32 TiB mapping in the\\nvirtual address space but only populates a single page:\\n\\n#include \u003cunistd.h\u003e\\n#include \u003cstdio.h\u003e\\n#include \u003csys/mman.h\u003e\\n\\n/* 32 TiB */\\nconst size_t size = 32ul * 1024 * 1024 * 1024 * 1024;\\n\\nint main() {\\n        char *area = mmap(NULL, size, PROT_READ | PROT_WRITE,\\n                          MAP_NORESERVE | MAP_PRIVATE | MAP_ANON, -1, 0);\\n\\n        if (area == MAP_FAILED) {\\n                perror(\\\"mmap() failed\\\\n\\\");\\n                return -1;\\n        }\\n\\n        /* Populate a single page such that we get an anon_vma. */\\n        *area = 0;\\n\\n        /* Enable KSM. */\\n        madvise(area, size, MADV_MERGEABLE);\\n        pause();\\n        return 0;\\n}\\n\\n$ ./ksm-sparse  \u0026\\n$ echo 1 \u003e /sys/kernel/mm/ksm/run \\n\\nWithout this patch ksmd uses 100% of the cpu for a long time (more then 1\\nhour in my test machine) scanning all the 32 TiB virtual address space\\nthat contain only one mapped page.  This makes ksmd essentially deadlocked\\nnot able to deduplicate anything of value.  With this patch ksmd walks\\nonly the one mapped page and skips the rest of the 32 TiB virtual address\\nspace, making the scan fast using little cpu.\"}],\"metrics\":{},\"references\":[{\"url\":\"https://git.kernel.org/stable/c/74f78421c925b6d17695566f0c5941de57fd44b3\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/f5548c318d6520d4fa3c5ed6003eeb710763cbc5\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/f62973e0767e4fcd6799087787fca08ca2a85b8c\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"}]}}"
  }
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.


Loading…

Loading…