]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
mm: shmem: fix missing cache flush in shmem_mfill_atomic_pte()
authorMuchun Song <songmuchun@bytedance.com>
Tue, 22 Mar 2022 21:42:05 +0000 (14:42 -0700)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 10 Aug 2022 07:22:02 +0000 (09:22 +0200)
commit4840dd221714f3b3db72bd0c6d9127943e3cadfc
tree06548c70a91ccd9e1d7680dd7476578da388021a
parentfdb6881588a809cf689a92d065618c7da4b35398
mm: shmem: fix missing cache flush in shmem_mfill_atomic_pte()

BugLink: https://bugs.launchpad.net/bugs/1980277
commit 19b482c29b6f3805f1d8e93015847b89e2f7f3b1 upstream.

userfaultfd calls shmem_mfill_atomic_pte() 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.  Insert flush_dcache_page() in non-zero-page case.  And replace
clear_highpage() with clear_user_highpage() which already considers the
cache maintenance.

Link: https://lkml.kernel.org/r/20220210123058.79206-6-songmuchun@bytedance.com
Fixes: 8d1039634206 ("userfaultfd: shmem: add shmem_mfill_zeropage_pte for userfaultfd support")
Fixes: 4c27fe4c4c84 ("userfaultfd: shmem: add shmem_mcopy_atomic_pte for userfaultfd support")
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Fam Zheng <fam.zheng@bytedance.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Lars Persson <lars.persson@axis.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Xiongchun Duan <duanxiongchun@bytedance.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
mm/shmem.c