From patchwork Tue Jul 13 05:52:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12372817 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89690C07E96 for ; Tue, 13 Jul 2021 05:52:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 32F7061004 for ; Tue, 13 Jul 2021 05:52:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 32F7061004 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 564B96B0095; Tue, 13 Jul 2021 01:52:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4EDA86B008C; Tue, 13 Jul 2021 01:52:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 367486B0098; Tue, 13 Jul 2021 01:52:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0068.hostedemail.com [216.40.44.68]) by kanga.kvack.org (Postfix) with ESMTP id 0A1AB6B008C for ; Tue, 13 Jul 2021 01:52:52 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 17F8927DD5 for ; Tue, 13 Jul 2021 05:52:51 +0000 (UTC) X-FDA: 78356495742.08.81D7409 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf15.hostedemail.com (Postfix) with ESMTP id 527B1D0000A7 for ; Tue, 13 Jul 2021 05:52:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=zp53bommybp1pk8ZrcPSSkhx3IAKKWZGzNvK/RyWeR0=; b=dcklGLuH/tB3sRJG6nd0c8BFWh VT5aqHFrCB6W1Hsv/Mi4HNEhcZ6CGseY2EXexBSNuphOkV+25bEBLg3H3UwxB8plA/yfBx87/imtu 9/N4DHy5sGRxFl2f3zcigHtc4bbHlpmSoQf0NjBp0LSv4z1D7f26rwrCcUoACx83M3hJIdG9SDdvF zmA8Fe7BY9LwIyMrtS9c/5Tg9LBam9Rf8GzS+0BCb5q3OIL5V/wzNPvXkxK2Qb/5HumbxxXhqr4iy JytL/aq4PoyynRtDUaZtiXUmrzOLfRf1LI8b5R/8JaoK3ySgE5HkwJkG0QYuw81uT2DxRklOQ1ihr cqaGSXpQ==; Received: from [2001:4bb8:184:8b7c:e5e6:2d8f:6506:596e] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3BLS-000mbI-Hs; Tue, 13 Jul 2021 05:52:39 +0000 From: Christoph Hellwig To: Andrew Morton Cc: Ira Weiny , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 1/2] mm: call flush_dcache_page in memcpy_to_page and memzero_page Date: Tue, 13 Jul 2021 07:52:30 +0200 Message-Id: <20210713055231.137602-2-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210713055231.137602-1-hch@lst.de> References: <20210713055231.137602-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=dcklGLuH; spf=none (imf15.hostedemail.com: domain of BATV@casper.srs.infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=BATV@casper.srs.infradead.org; dmarc=none X-Rspamd-Server: rspam05 X-Stat-Signature: atf9x4ftgfgi6hfbkzd1uzo415wwdctf X-Rspamd-Queue-Id: 527B1D0000A7 X-HE-Tag: 1626155570-921169 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: memcpy_to_page and memzero_page can write to arbitrary pages, which could be in the page cache or in high memory, so call flush_kernel_dcache_pages to flush the dcache. Fixes: bb90d4bc7b6a ("mm/highmem: Lift memcpy_[to|from]_page to core") Fixes: 28961998f858 ("iov_iter: lift memzero_page() to highmem.h") Signed-off-by: Christoph Hellwig Reviewed-by: Ira Weiny --- include/linux/highmem.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 8c6e8e996c87..8e7e50a53a12 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -318,6 +318,7 @@ static inline void memcpy_to_page(struct page *page, size_t offset, VM_BUG_ON(offset + len > PAGE_SIZE); memcpy(to + offset, from, len); + flush_dcache_page(page); kunmap_local(to); } @@ -325,6 +326,7 @@ static inline void memzero_page(struct page *page, size_t offset, size_t len) { char *addr = kmap_atomic(page); memset(addr + offset, 0, len); + flush_dcache_page(page); kunmap_atomic(addr); }