Description
In the Linux kernel, the following vulnerability has been resolved:
mm/execmem: free ROX cache chunks only when they span an entire vm area
Patch series "mm/execmem: fixes and cleanups for the ROX cache".
Sashiko review of the ROX cache refill path asked what happens when the
PMD_SIZE allocation fails there. Pulling that thread uncovered a bit more
than the fallback.
Patch 1 fixes a real bug, although rare bug: execmem_cache_clean() can
free a chunk that is still partially in use, because a PMD sized and PMD
aligned free range in the middle of a larger chunk looks exactly like a
chunk that nobody uses.
Patch 2 handles maple tree allocation failures in the cache. They are
unlikely, but silently dropping an area from the tree is not a great way
to deal with them.
Patch 3 deals with the fallback that started all this. The cache exists
to keep the direct map free of unnecessary splits, and the fallback
happily filled it with base page mapped areas that could never be freed
from the cache again. Ask vmalloc for a huge mapping or nothing, and
serve whatever does not fit outside the cache.
Patches 4 and 5 convert the ROX cache to scope based cleanup.
The series was tested on x86 with module load/unload cycles, with PTDUMP
confirming that the cache is using 2M mappings, and with nohugevmalloc to
exercise the uncached fallback.
This patch (of 5):
When execmem refills the ROX cache, it vmalloc()s multiples of PMD_SIZE
aligned to PMD_SIZE. For every such allocation vmalloc creates a vm area.
The first part of the vmalloc()ed chunk is returned to the allocation that
triggered the cache refill and the remaining part is added to the cache
and handed out for subsequent allocations with execmem_alloc().
When only the first part is freed, the entire vm area remains in the ROX
cache and can be handed out again.
In the case when the first allocation is larger than PMD_SIZE and the
second allocation from the freed first part of the chunk is exactly
PMD_SIZE, execmem_cache_clean() will free the entire chunk while part of
it is still in use.
For example:
/*
* vmalloc(4M), return p0 to the caller
* add [p0 + 3M, p0 + 4M) to the cache
*/
p0 = execmem_alloc(3M);
/* return p0 + 3M from the cache to the caller */
p1 = execmem_alloc(1M);
/* put [p0, p0 + 3M) back into the cache */
execmem_free(p0);
/* return p0 from the cache to the caller */
p2 = execmem_alloc(2M);
/* return p0 + 2M from the cache to the caller */
p3 = execmem_alloc(1M);
/* bah! execmem_cache_clean() frees the entire 4M chunk */
execmem_free(p2);
Make sure that the ranges that execmem_cache_clean() frees cover the
entire vm area.
mm/execmem: free ROX cache chunks only when they span an entire vm area
Patch series "mm/execmem: fixes and cleanups for the ROX cache".
Sashiko review of the ROX cache refill path asked what happens when the
PMD_SIZE allocation fails there. Pulling that thread uncovered a bit more
than the fallback.
Patch 1 fixes a real bug, although rare bug: execmem_cache_clean() can
free a chunk that is still partially in use, because a PMD sized and PMD
aligned free range in the middle of a larger chunk looks exactly like a
chunk that nobody uses.
Patch 2 handles maple tree allocation failures in the cache. They are
unlikely, but silently dropping an area from the tree is not a great way
to deal with them.
Patch 3 deals with the fallback that started all this. The cache exists
to keep the direct map free of unnecessary splits, and the fallback
happily filled it with base page mapped areas that could never be freed
from the cache again. Ask vmalloc for a huge mapping or nothing, and
serve whatever does not fit outside the cache.
Patches 4 and 5 convert the ROX cache to scope based cleanup.
The series was tested on x86 with module load/unload cycles, with PTDUMP
confirming that the cache is using 2M mappings, and with nohugevmalloc to
exercise the uncached fallback.
This patch (of 5):
When execmem refills the ROX cache, it vmalloc()s multiples of PMD_SIZE
aligned to PMD_SIZE. For every such allocation vmalloc creates a vm area.
The first part of the vmalloc()ed chunk is returned to the allocation that
triggered the cache refill and the remaining part is added to the cache
and handed out for subsequent allocations with execmem_alloc().
When only the first part is freed, the entire vm area remains in the ROX
cache and can be handed out again.
In the case when the first allocation is larger than PMD_SIZE and the
second allocation from the freed first part of the chunk is exactly
PMD_SIZE, execmem_cache_clean() will free the entire chunk while part of
it is still in use.
For example:
/*
* vmalloc(4M), return p0 to the caller
* add [p0 + 3M, p0 + 4M) to the cache
*/
p0 = execmem_alloc(3M);
/* return p0 + 3M from the cache to the caller */
p1 = execmem_alloc(1M);
/* put [p0, p0 + 3M) back into the cache */
execmem_free(p0);
/* return p0 from the cache to the caller */
p2 = execmem_alloc(2M);
/* return p0 + 2M from the cache to the caller */
p3 = execmem_alloc(1M);
/* bah! execmem_cache_clean() frees the entire 4M chunk */
execmem_free(p2);
Make sure that the ranges that execmem_cache_clean() frees cover the
entire vm area.
Published:
2026-11-30
Score:
n/a
EPSS:
n/a
KEV:
No
Impact:
n/a
Action:
n/a
Analysis and contextual insights are available on OpenCVE Cloud.
Remediation
No vendor fix or workaround currently provided.
Additional remediation guidance may be available on OpenCVE Cloud.
Tracking
Sign in to view the affected projects.
Advisories
No advisories yet.
References
History
Mon, 30 Nov 2026 13:30:00 +0000
| Type | Values Removed | Values Added |
|---|---|---|
| Description | In the Linux kernel, the following vulnerability has been resolved: mm/execmem: free ROX cache chunks only when they span an entire vm area Patch series "mm/execmem: fixes and cleanups for the ROX cache". Sashiko review of the ROX cache refill path asked what happens when the PMD_SIZE allocation fails there. Pulling that thread uncovered a bit more than the fallback. Patch 1 fixes a real bug, although rare bug: execmem_cache_clean() can free a chunk that is still partially in use, because a PMD sized and PMD aligned free range in the middle of a larger chunk looks exactly like a chunk that nobody uses. Patch 2 handles maple tree allocation failures in the cache. They are unlikely, but silently dropping an area from the tree is not a great way to deal with them. Patch 3 deals with the fallback that started all this. The cache exists to keep the direct map free of unnecessary splits, and the fallback happily filled it with base page mapped areas that could never be freed from the cache again. Ask vmalloc for a huge mapping or nothing, and serve whatever does not fit outside the cache. Patches 4 and 5 convert the ROX cache to scope based cleanup. The series was tested on x86 with module load/unload cycles, with PTDUMP confirming that the cache is using 2M mappings, and with nohugevmalloc to exercise the uncached fallback. This patch (of 5): When execmem refills the ROX cache, it vmalloc()s multiples of PMD_SIZE aligned to PMD_SIZE. For every such allocation vmalloc creates a vm area. The first part of the vmalloc()ed chunk is returned to the allocation that triggered the cache refill and the remaining part is added to the cache and handed out for subsequent allocations with execmem_alloc(). When only the first part is freed, the entire vm area remains in the ROX cache and can be handed out again. In the case when the first allocation is larger than PMD_SIZE and the second allocation from the freed first part of the chunk is exactly PMD_SIZE, execmem_cache_clean() will free the entire chunk while part of it is still in use. For example: /* * vmalloc(4M), return p0 to the caller * add [p0 + 3M, p0 + 4M) to the cache */ p0 = execmem_alloc(3M); /* return p0 + 3M from the cache to the caller */ p1 = execmem_alloc(1M); /* put [p0, p0 + 3M) back into the cache */ execmem_free(p0); /* return p0 from the cache to the caller */ p2 = execmem_alloc(2M); /* return p0 + 2M from the cache to the caller */ p3 = execmem_alloc(1M); /* bah! execmem_cache_clean() frees the entire 4M chunk */ execmem_free(p2); Make sure that the ranges that execmem_cache_clean() frees cover the entire vm area. | |
| Title | mm/execmem: free ROX cache chunks only when they span an entire vm area | |
| First Time appeared |
Linux
Linux linux Kernel |
|
| CPEs | cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | |
| Vendors & Products |
Linux
Linux linux Kernel |
|
| References |
|
Status: PUBLISHED
Assigner: Linux
Published:
Updated: 2026-11-30T13:25:43.142Z
Reserved: 2026-11-30T13:22:15.899Z
Link: CVE-2026-138866
No data.
Status : Received
Published: 2026-11-30T14:17:43.133
Modified: 2026-11-30T14:17:43.133
Link: CVE-2026-138866
No data.
OpenCVE Enrichment
No data.
Weaknesses
No weakness.