Re: [PATCH v4 4/5] mm: hugetlb: fix missing cache flush in hugetlb_mcopy_atomic_pte()

From: Mike Kravetz
Date: Wed Feb 09 2022 - 17:14:58 EST


On 2/7/22 23:36, Muchun Song wrote:
> 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.
>
> Fixes: 8cc5fcbb5be8 ("mm, hugetlb: fix racy resv_huge_pages underflow on UFFDIO_COPY")
> Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>
> ---
> mm/hugetlb.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)

Thanks! This will also make backports easier.

Reviewed-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>

--
Mike Kravetz