Skip to contentSkip to conversation

hugetlb_cgroup-fix-illegal-access-to-memory.patch removed from -mm tree

merged [email protected] 1 participant 1 message Mar 30, 2020

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: hugetlb_cgroup: fix illegal access to memory
has been removed from the -mm tree. Its filename was
hugetlb_cgroup-fix-illegal-access-to-memory.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Mina Almasry <[email protected]>
Subject: hugetlb_cgroup: fix illegal access to memory

This appears to be a mistake in commit faced7e0806cf ("mm: hugetlb controller for cgroups v2"). Essentially that commit does a hugetlb_cgroup_from_counter assuming that page_counter_try_charge has initialized counter, but if page_counter_try_charge has failed then it seems it does not initialize counter, so hugetlb_cgroup_from_counter(counter) ends up pointing to random memory, causing kasan to complain.

Solution, simply use h_cg, instead of hugetlb_cgroup_from_counter(counter), since that is a reference to the hugetlb_cgroup anyway. After this change kasan ceases to complain.

Fixes faced7e0806cf ("mm: hugetlb controller for cgroups v2")
Reported-by [email protected]
Cc Mike Kravetz <[email protected]>
Cc David Rientjes <[email protected]>

---

 mm/hugetlb_cgroup.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
mm/hugetlb_cgroup.c renamed from mm/hugetlb_cgroup.c~hugetlb_cgroup-fix-illegal-access-to-memory +1 -2
@@ -240,8 +240,7 @@ again:
 	if (!page_counter_try_charge(&h_cg->hugepage[idx], nr_pages,
 				     &counter)) {
 		ret = -ENOMEM;
-		hugetlb_event(hugetlb_cgroup_from_counter(counter, idx), idx,
-			      HUGETLB_MAX);
+		hugetlb_event(h_cg, idx, HUGETLB_MAX);
 	}
 	css_put(&h_cg->css);
 done:

_

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

hugetlb_cgroup-add-hugetlb_cgroup-reservation-counter.patch hugetlb_cgroup-add-interface-for-charge-uncharge-hugetlb-reservations.patch mm-hugetlb_cgroup-fix-hugetlb_cgroup-migration.patch hugetlb_cgroup-add-reservation-accounting-for-private-mappings.patch hugetlb-disable-region_add-file_region-coalescing.patch hugetlb-disable-region_add-file_region-coalescing-fix.patch hugetlb_cgroup-add-accounting-for-shared-mappings.patch hugetlb_cgroup-support-noreserve-mappings.patch hugetlb-support-file_region-coalescing-again.patch hugetlb-support-file_region-coalescing-again-fix.patch hugetlb-support-file_region-coalescing-again-fix-2.patch hugetlb_cgroup-add-hugetlb_cgroup-reservation-tests.patch hugetlb_cgroup-add-hugetlb_cgroup-reservation-docs.patch