From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABEC7C433EF for ; Fri, 13 May 2022 08:56:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378300AbiEMI4v (ORCPT ); Fri, 13 May 2022 04:56:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378747AbiEMI4u (ORCPT ); Fri, 13 May 2022 04:56:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D8CF606CF for ; Fri, 13 May 2022 01:56:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2DF21B82CA1 for ; Fri, 13 May 2022 08:56:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75954C34100; Fri, 13 May 2022 08:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652432206; bh=26yXaJoOmdgX0V2sBsDjJdga9dhOZqcPStfMx97hsqk=; h=Subject:To:Cc:From:Date:From; b=naNIy3rxYILDecoIh+6u2V7CMfNWT2r37OEefj3FglhG4ikI3D/yeLUh0mrRs/+jd ZB/M+ItEcw1KBtDRDV5PbtMacWgQuVuevFoxd+UBwulDSNr8pC61HOBT5V2qwbXV17 JjfNejYDHofdyPINQgb5cTtV/80YjF9tmQH02aiI= Subject: FAILED: patch "[PATCH] mm: shmem: fix missing cache flush in" failed to apply to 4.19-stable tree To: songmuchun@bytedance.com, akpm@linux-foundation.org, axelrasmussen@google.com, duanxiongchun@bytedance.com, fam.zheng@bytedance.com, kirill.shutemov@linux.intel.com, lars.persson@axis.com, mike.kravetz@oracle.com, peterx@redhat.com, rientjes@google.com, torvalds@linux-foundation.org, ziy@nvidia.com Cc: From: Date: Fri, 13 May 2022 10:56:32 +0200 Message-ID: <165243219215521@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.19-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 19b482c29b6f3805f1d8e93015847b89e2f7f3b1 Mon Sep 17 00:00:00 2001 From: Muchun Song Date: Tue, 22 Mar 2022 14:42:05 -0700 Subject: [PATCH] mm: shmem: fix missing cache flush in shmem_mfill_atomic_pte() 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 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 diff --git a/mm/shmem.c b/mm/shmem.c index f21eb0ef8ae0..01fd227b6947 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2364,8 +2364,10 @@ int shmem_mfill_atomic_pte(struct mm_struct *dst_mm, /* don't free the page */ goto out_unacct_blocks; } + + flush_dcache_page(page); } else { /* ZEROPAGE */ - clear_highpage(page); + clear_user_highpage(page, dst_addr); } } else { page = *pagep;