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 X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 4C32FC352A3 for ; Tue, 11 Feb 2020 16:44:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0D3F820714 for ; Tue, 11 Feb 2020 16:44:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NIW1b/P7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D3F820714 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A6BDF6B02F3; Tue, 11 Feb 2020 11:44:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A1D096B02F5; Tue, 11 Feb 2020 11:44:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 90AFC6B02F6; Tue, 11 Feb 2020 11:44:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0071.hostedemail.com [216.40.44.71]) by kanga.kvack.org (Postfix) with ESMTP id 77AB36B02F3 for ; Tue, 11 Feb 2020 11:44:14 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id F3B2A2C33 for ; Tue, 11 Feb 2020 16:44:13 +0000 (UTC) X-FDA: 76478418786.17.cave27_41f8030fa9e43 X-HE-Tag: cave27_41f8030fa9e43 X-Filterd-Recvd-Size: 4105 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Tue, 11 Feb 2020 16:44:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581439452; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t9WYRnaFRg7wHdSewQdbObtwRzFouBAUhV7k515vAbc=; b=NIW1b/P7drQPlLPPCaalFm9WjtFAYbnrcqcoVaKey9PZz4MBBPsffw2a65pDLfz9uYnDu5 BMCbkBOC95bTV6NeprvpwCxVqWAWqm1Tn8Ng8wlirr+nh1FwrYs/cu9BxFcaWj+pxEdXE6 S9RfYSscBkZttpLt9rz6tLCS+54g5Jc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-403-VGQ4UzyXNAuDLntAPizfgA-1; Tue, 11 Feb 2020 11:44:08 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 74D038010C7; Tue, 11 Feb 2020 16:44:07 +0000 (UTC) Received: from segfault.boston.devel.redhat.com (segfault.boston.devel.redhat.com [10.19.60.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D7A0D8EA1A; Tue, 11 Feb 2020 16:44:06 +0000 (UTC) From: Jeff Moyer To: Justin He Cc: Catalin Marinas , Kirill A.Shutemov , "linux-mm\@kvack.org" Subject: Re: bug: data corruption introduced by commit 83d116c53058 ("mm: fix double page fault on arm64 if PTE_AF is cleared") References: X-PGP-KeyID: 1F78E1B4 X-PGP-CertKey: F6FE 280D 8293 F72C 65FD 5A58 1FF8 A7CA 1F78 E1B4 Date: Tue, 11 Feb 2020 11:44:06 -0500 In-Reply-To: (Justin He's message of "Tue, 11 Feb 2020 04:29:49 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: VGQ4UzyXNAuDLntAPizfgA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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: Hi, Justin, Justin He writes: >> Thanks for the report. But this commit 83d116c53058 doesn't add the >> new clear_page code path. Besides the pte_mkyoung part, It just refines >> the codes(no functional change) and add a WARN_ON_ONCE to indicate >> there is any obscure case before. > > I can't reproduce it with your provided test file on my arm64 qemu with > a pmem device. > Could you do me a favor that just revert 83d116c53058 but keep that > WARN_ON_ONCE after clear_page()? Is there any difference? > Thanks for your help Below is the patch I used to put the WARN_ON_ONCE after the clear_page, just to be sure that's what you intended. So with 83d116c53058 reverted, and the below patch applied, the WARN_ON_ONCE does not trigger. -Jeff diff --git a/mm/memory.c b/mm/memory.c index 3bab0d3976ea..3fea34375c7f 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2259,8 +2259,10 @@ static inline void cow_user_page(struct page *dst, s= truct page *src, unsigned lo =09=09 * in which case we just give up and fill the result with =09=09 * zeroes. =09=09 */ -=09=09if (__copy_from_user_inatomic(kaddr, uaddr, PAGE_SIZE)) +=09=09if (__copy_from_user_inatomic(kaddr, uaddr, PAGE_SIZE)) { +=09=09=09WARN_ON_ONCE(1); =09=09=09clear_page(kaddr); +=09=09} =09=09kunmap_atomic(kaddr); =09=09flush_dcache_page(dst); =09} else