{"id":"CVE-2025-68211","aliases":["CVE-2025-68211"],"related":[],"kind":"vulnerability","state":"published","title":"ksm: use range-walk function to jump over holes in scan_get_next_rmap_item","summary":"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 <unistd.h>\n#include <stdio.h>\n#include <sys/mman.h>\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  &\n$ echo 1 > /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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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 <unistd.h>\n#include <stdio.h>\n#include <sys/mman.h>\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  &\n$ echo 1 > /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.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\nksm: usar la función de recorrido de rango para saltar sobre los huecos en scan_get_next_rmap_item\n\nActualmente, scan_get_next_rmap_item() recorre cada dirección de página en un VMA para localizar páginas fusionables. Esto se vuelve altamente ineficiente al escanear grandes áreas de memoria virtual que contienen en su mayoría regiones no mapeadas, lo que hace que ksmd use una gran cantidad de CPU sin desduplicar muchas páginas.\n\nEste parche reemplaza la búsqueda por dirección con un recorrido de rango usando walk_page_range(). El recorredor de rangos permite a KSM saltar sobre huecos no mapeados completos en un VMA, evitando búsquedas innecesarias. Este problema fue discutido previamente en [1].\n\nConsidere el siguiente programa de prueba que crea un mapeo de 32 TiB en el espacio de direcciones virtual pero solo rellena una única página:\n\n#include <unistd.h>\n#include <stdio.h>\n#include <sys/mman.h>\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  &\n$ echo 1 > /sys/kernel/mm/ksm/run \n\nSin este parche, ksmd usa el 100% de la CPU durante mucho tiempo (más de 1 hora en mi máquina de prueba) escaneando todo el espacio de direcciones virtual de 32 TiB que contiene solo una página mapeada. Esto hace que ksmd quede esencialmente bloqueado sin poder desduplicar nada de valor. Con este parche, ksmd recorre solo la página mapeada y salta el resto del espacio de direcciones virtual de 32 TiB, haciendo que el escaneo sea rápido usando poca CPU.","source":"nvd"}],"published":"2025-12-16T13:48:37.959Z","modified":"2026-10-14T13:10:00.187Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},"severities":[{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"}],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"31dbd01f314364b70c2e026a5793a29a4da8a9dc","fixed":"220cb3e425e17587f560335924cba9f16a842c64","status":"affected"},{"type":"git","introduced":"31dbd01f314364b70c2e026a5793a29a4da8a9dc","fixed":"10644e8839544dd5699c03c8fb1aeeefc41602fd","status":"affected"},{"type":"git","introduced":"31dbd01f314364b70c2e026a5793a29a4da8a9dc","fixed":"67137b715b7db28d82e4ed07a7092c2fa6ba7adb","status":"affected"},{"type":"git","introduced":"31dbd01f314364b70c2e026a5793a29a4da8a9dc","fixed":"9c2f8a9b68024e5ebb4813665845ec0a95f2eac3","status":"affected"},{"type":"git","introduced":"31dbd01f314364b70c2e026a5793a29a4da8a9dc","fixed":"74f78421c925b6d17695566f0c5941de57fd44b3","status":"affected"},{"type":"git","introduced":"31dbd01f314364b70c2e026a5793a29a4da8a9dc","fixed":"f62973e0767e4fcd6799087787fca08ca2a85b8c","status":"affected"},{"type":"git","introduced":"31dbd01f314364b70c2e026a5793a29a4da8a9dc","fixed":"f5548c318d6520d4fa3c5ed6003eeb710763cbc5","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"2.6.32","status":"affected"},{"type":"semver","introduced":"0","fixed":"2.6.32","status":"unaffected"},{"type":"semver","introduced":"5.10.249","lastAffected":"5.10.*","status":"unaffected"},{"type":"semver","introduced":"5.15.199","lastAffected":"5.15.*","status":"unaffected"},{"type":"semver","introduced":"6.1.161","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.121","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.59","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.17.9","lastAffected":"6.17.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"6.18","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"status":"affected","introduced":"2.6.32","fixed":"5.10.249"},{"status":"affected","introduced":"5.11","fixed":"5.15.199"},{"status":"affected","introduced":"5.16","fixed":"6.1.161"},{"status":"affected","introduced":"6.2","fixed":"6.6.121"},{"status":"affected","introduced":"6.7","fixed":"6.12.59"},{"status":"affected","introduced":"6.13","fixed":"6.17.9"},{"status":"affected","version":"6.18"},{"status":"affected","version":"6.18"},{"status":"affected","version":"6.18"},{"status":"affected","version":"6.18"},{"status":"affected","version":"6.18"}],"vendor":"linux","product":"linux_kernel","cpe":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://git.kernel.org/stable/c/220cb3e425e17587f560335924cba9f16a842c64","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/10644e8839544dd5699c03c8fb1aeeefc41602fd","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/67137b715b7db28d82e4ed07a7092c2fa6ba7adb","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/9c2f8a9b68024e5ebb4813665845ec0a95f2eac3","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/74f78421c925b6d17695566f0c5941de57fd44b3","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/f62973e0767e4fcd6799087787fca08ca2a85b8c","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/f5548c318d6520d4fa3c5ed6003eeb710763cbc5","tags":["patch"],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-06-10T20:42:07.997Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-68211","url":"https://www.cve.org/CVERecord?id=CVE-2025-68211","licence":"CVE Terms of Use","modified":"2026-06-11T18:44:19.687Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-68211","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-68211","licence":"Public domain","modified":"2026-10-14T13:10:00.187Z"}],"updatedAt":"2026-11-25T22:59:09.496Z","epss":{"score":0.00158,"percentile":0.05206,"date":"2026-12-01T12:00:22.000Z"}}