Skip to contentSkip to conversation

mm-cma-accept-memory-of-multi-range-cma-areas.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Nov 3 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/cma: accept memory of multi-range CMA areas
has been removed from the -mm tree. Its filename was
mm-cma-accept-memory-of-multi-range-cma-areas.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: "Mike Rapoport (Microsoft)" <[email protected]>
Subject: mm/cma: accept memory of multi-range CMA areas
Date: Thu, 29 Oct 2026 12:18:37 +0200

Patch series "mm/cma: accept memory of CMA areas reserved with memblock_reserve()", v1.

Pages of allocated CMA areas are released to the buddy allocator with __free_pages(), which does not check for unaccepted memory.

This usually works because memblock accepts the memory it allocates.

However, multi-range CMA areas, used by hugetlb_cma, and fixed CMA areas requested with cma=<size>@<base> are reserved with memblock_reserve() and their memory is never accepted.

On TDX and SEV-SNP guests the first access to such a page is fatal.

To ease the backporting, each case is addressed by a separate patch:
- patch 1 accepts the memory of multi-range CMA areas
- patch 2 does the same for the fixed CMA areas

The second patch won't apply cleanly to 6.6 and 6.12, but I believe the stable team LLMs will take care of that :)

This patch (of 2):

On systems with unaccepted memory, memblock allocations accept the allocated range, but when cma_declare_contiguous_multi() uses open coded allocation of multiple ranges, it reserves them with memblock_reserve() and they are never accepted.

These pages are released to the buddy allocator by cma_activate_area() with __free_pages() that does not check for unaccepted memory, so the first access to such a page in a TDX or SEV-SNP guest is fatal.

Accept the memory of each range when it is reserved.

Fixes c009da4258f9 ("mm, cma: support multiple contiguous ranges, if requested")
Cc David Hildenbrand <[email protected]>
Cc Liam R. Howlett <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Vlastimil Babka <[email protected]>

---

 mm/cma.c |    2 ++
 1 file changed, 2 insertions(+)
mm/cma.c renamed from mm/cma.c~mm-cma-accept-memory-of-multi-range-cma-areas +2 -0
@@ -678,6 +678,8 @@ int __init cma_declare_contiguous_multi(
 			break;
 		}
 
+		accept_memory(mlp->base, size);
+
 		pr_debug("created region %d: %016llx - %016llx\n",
 		    nr, (u64)mlp->base, (u64)mlp->base + size);
 		cmrp = &cma->ranges[nr++];

_

Patches currently in -mm which might be from [email protected] are

userfaultfd-clear-uffd-state-in-child-ptes-if-uffd-is-released-during-fork.patch mm-vma-undo-userfaultfd-unmap-preparation-when-unmapping-fails.patch hibernation-make-swsusp_page-helpers-static.patch hibernation-ensure-secretmem-pages-dont-reach-a-snapshot.patch hibernate-handle-potential-errors-in-hibernate_mapunmap_page.patch hibernation-kfence-explicitly-map-unmap-kfence-pages.patch hibernation-make-hibernation-unavailable-when-debug_pagealloc-is-on.patch