{
  "affected": [
    {
      "ranges": [
        {
          "events": [
            {
              "introduced": "2e45474ab14f0f17c1091c503a13ff2fe2a84486"
            },
            {
              "fixed": "e4dcde9709a25f5301f0a1cc5f6f76485aea2c48"
            },
            {
              "fixed": "8c60564f03e0f83dfe4ee4484a3adcd4426f1594"
            },
            {
              "fixed": "52d95a55a0113408acd2d4ce0294a72c527f5092"
            }
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "type": "GIT"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "Linux",
        "name": "Kernel"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "6.13.0"
            },
            {
              "fixed": "6.18.63"
            }
          ],
          "type": "ECOSYSTEM"
        },
        {
          "events": [
            {
              "introduced": "6.19.0"
            },
            {
              "fixed": "7.3.4"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "database_specific": {
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/138xxx/CVE-2026-138866.json"
  },
  "details": "In the Linux kernel, the following vulnerability has been resolved:\n\nmm/execmem: free ROX cache chunks only when they span an entire vm area\n\nPatch series \"mm/execmem: fixes and cleanups for the ROX cache\".\n\nSashiko review of the ROX cache refill path asked what happens when the\nPMD_SIZE allocation fails there.  Pulling that thread uncovered a bit more\nthan the fallback.\n\nPatch 1 fixes a real bug, although rare bug: execmem_cache_clean() can\nfree a chunk that is still partially in use, because a PMD sized and PMD\naligned free range in the middle of a larger chunk looks exactly like a\nchunk that nobody uses.\n\nPatch 2 handles maple tree allocation failures in the cache.  They are\nunlikely, but silently dropping an area from the tree is not a great way\nto deal with them.\n\nPatch 3 deals with the fallback that started all this.  The cache exists\nto keep the direct map free of unnecessary splits, and the fallback\nhappily filled it with base page mapped areas that could never be freed\nfrom the cache again.  Ask vmalloc for a huge mapping or nothing, and\nserve whatever does not fit outside the cache.\n\nPatches 4 and 5 convert the ROX cache to scope based cleanup.\n\nThe series was tested on x86 with module load/unload cycles, with PTDUMP\nconfirming that the cache is using 2M mappings, and with nohugevmalloc to\nexercise the uncached fallback.\n\n\nThis patch (of 5):\n\nWhen execmem refills the ROX cache, it vmalloc()s multiples of PMD_SIZE\naligned to PMD_SIZE.  For every such allocation vmalloc creates a vm area.\n\nThe first part of the vmalloc()ed chunk is returned to the allocation that\ntriggered the cache refill and the remaining part is added to the cache\nand handed out for subsequent allocations with execmem_alloc().\n\nWhen only the first part is freed, the entire vm area remains in the ROX\ncache and can be handed out again.\n\nIn the case when the first allocation is larger than PMD_SIZE and the\nsecond allocation from the freed first part of the chunk is exactly\nPMD_SIZE, execmem_cache_clean() will free the entire chunk while part of\nit is still in use.\n\nFor example:\n\n\t/*\n\t * vmalloc(4M), return p0 to the caller\n\t * add [p0 + 3M, p0 + 4M) to the cache\n\t */\n\tp0 = execmem_alloc(3M);\n\n\t/* return p0 + 3M from the cache to the caller */\n\tp1 = execmem_alloc(1M);\n\n\t/* put [p0, p0 + 3M) back into the cache */\n\texecmem_free(p0);\n\n\t/* return p0 from the cache to the caller */\n\tp2 = execmem_alloc(2M);\n\n\t/* return p0 + 2M from the cache to the caller */\n\tp3 = execmem_alloc(1M);\n\n\t/* bah! execmem_cache_clean() frees the entire 4M chunk */\n\texecmem_free(p2);\n\nMake sure that the ranges that execmem_cache_clean() frees cover the\nentire vm area.",
  "id": "CVE-2026-138866",
  "modified": "2026-11-30T14:45:16.866665062Z",
  "published": "2026-11-30T13:25:43.142Z",
  "references": [
    {
      "type": "PACKAGE",
      "url": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/52d95a55a0113408acd2d4ce0294a72c527f5092"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/8c60564f03e0f83dfe4ee4484a3adcd4426f1594"
    },
    {
      "type": "WEB",
      "url": "https://git.kernel.org/stable/c/e4dcde9709a25f5301f0a1cc5f6f76485aea2c48"
    },
    {
      "type": "ADVISORY",
      "url": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/138xxx/CVE-2026-138866.json"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-138866"
    }
  ],
  "schema_version": "1.9.2",
  "summary": "mm/execmem: free ROX cache chunks only when they span an entire vm area"
}