[lkml]   [2022]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 5.10 09/10] mm: hugetlb: fix missing cache flush in copy_huge_page_from_user()
From: Muchun Song <>

commit e763243cc6cb1fcc720ec58cfd6e7c35ae90a479 upstream.

userfaultfd calls copy_huge_page_from_user() which does not do any cache
flushing for the target page. Then the target page will be mapped to
the user space with a different address (user address), which might have
an alias issue with the kernel address used to copy the data from the
user to.

Fix this issue by flushing dcache in copy_huge_page_from_user().

Fixes: fa4d75c1de13 ("userfaultfd: hugetlbfs: add copy_huge_page_from_user for hugetlb userfaultfd support")
Signed-off-by: Muchun Song <>
Reviewed-by: Mike Kravetz <>
Cc: Axel Rasmussen <>
Cc: David Rientjes <>
Cc: Fam Zheng <>
Cc: Kirill A. Shutemov <>
Cc: Lars Persson <>
Cc: Peter Xu <>
Cc: Xiongchun Duan <>
Cc: Zi Yan <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
Signed-off-by: Greg Kroah-Hartman <>
mm/memory.c | 2 ++
1 file changed, 2 insertions(+)

--- a/mm/memory.c
+++ b/mm/memory.c
@@ -5295,6 +5295,8 @@ long copy_huge_page_from_user(struct pag
if (rc)

+ flush_dcache_page(subpage);
return ret_val;

 \ /
  Last update: 2022-05-13 16:33    [W:0.169 / U:0.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site