Skip to contentSkip to conversation

mm-hugetlb-fix-missing-cache-flush-in-hugetlb_mcopy_atomic_pte.patch removed from -mm tree

merged Andrew Morton 1 participant 1 message Mar 25, 2022

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The patch titled
Subject: mm: hugetlb: fix missing cache flush in hugetlb_mcopy_atomic_pte()
has been removed from the -mm tree. Its filename was
mm-hugetlb-fix-missing-cache-flush-in-hugetlb_mcopy_atomic_pte.patch

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

------------------------------------------------------
From: Muchun Song <[email protected]>
Subject: mm: hugetlb: fix missing cache flush in hugetlb_mcopy_atomic_pte()

folio_copy() will copy the data from one page to the target page, then the target page will be mapped to the user space address, which might have an alias issue with the kernel address used to copy the data from the page to. There are 2 ways to fix this issue.

1) insert flush_dcache_page() after folio_copy().
2) replace folio_copy() with copy_user_huge_page() which already considers the cache maintenance.

We chose 2) way to fix the issue since architectures can optimize this situation. It is also make backports easier.

Fixes 8cc5fcbb5be8 ("mm, hugetlb: fix racy resv_huge_pages underflow on UFFDIO_COPY")
Cc Axel Rasmussen <[email protected]>
Cc David Rientjes <[email protected]>
Cc Fam Zheng <[email protected]>
Cc Kirill A. Shutemov <[email protected]>
Cc Lars Persson <[email protected]>
Cc Peter Xu <[email protected]>
Cc Xiongchun Duan <[email protected]>
Cc Zi Yan <[email protected]>

---

 mm/hugetlb.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
mm/hugetlb.c renamed from mm/hugetlb.c~mm-hugetlb-fix-missing-cache-flush-in-hugetlb_mcopy_atomic_pte +2 -1
@@ -5816,7 +5816,8 @@ int hugetlb_mcopy_atomic_pte(struct mm_s
 			*pagep = NULL;
 			goto out;
 		}
-		folio_copy(page_folio(page), page_folio(*pagep));
+		copy_user_huge_page(page, *pagep, dst_addr, dst_vma,
+				    pages_per_huge_page(h));
 		put_page(*pagep);
 		*pagep = NULL;
 	}

_

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