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=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,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 838CDC352A3 for ; Tue, 11 Feb 2020 16:27:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3BF0E20708 for ; Tue, 11 Feb 2020 16:27:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fBoev9Me" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3BF0E20708 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 D37CC6B02EE; Tue, 11 Feb 2020 11:27:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CE7FC6B02EF; Tue, 11 Feb 2020 11:27:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BFD286B02F0; Tue, 11 Feb 2020 11:27:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0135.hostedemail.com [216.40.44.135]) by kanga.kvack.org (Postfix) with ESMTP id A5BAA6B02EE for ; Tue, 11 Feb 2020 11:27:43 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 3E4631F06 for ; Tue, 11 Feb 2020 16:27:43 +0000 (UTC) X-FDA: 76478377206.20.egg20_43559113bba15 X-HE-Tag: egg20_43559113bba15 X-Filterd-Recvd-Size: 3196 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Tue, 11 Feb 2020 16:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581438462; 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=8LXPyiTig39mIpEg03dY9E3xom+z/51pMvo0LDT6hCI=; b=fBoev9MeofXywQdILFHejiD9YlD+uJX47S+s/C5dN1DC4cuWUlCvSm56VprYTnIDYnk5Wq fPk66wDTCuX+TGXKoqLaVxFFbN3U0ioI2lO1wSSe4LNICnmzk5VHiI85njBbxT6mBgW9Te 0WOTl41gD8qCvzsOS3L7M8KN+YL/KcA= 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-212-OcUhFUNLMhCXdAG43APkcw-1; Tue, 11 Feb 2020 11:27:40 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A13DD477; Tue, 11 Feb 2020 16:27:38 +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 A67411000325; Tue, 11 Feb 2020 16:27:37 +0000 (UTC) From: Jeff Moyer To: "Kirill A. Shutemov" Cc: Jia He , 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: <20200211145158.5wt7nepe3flx25bj@box> X-PGP-KeyID: 1F78E1B4 X-PGP-CertKey: F6FE 280D 8293 F72C 65FD 5A58 1FF8 A7CA 1F78 E1B4 Date: Tue, 11 Feb 2020 11:27:36 -0500 In-Reply-To: <20200211145158.5wt7nepe3flx25bj@box> (Kirill A. Shutemov's message of "Tue, 11 Feb 2020 17:51:58 +0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: OcUhFUNLMhCXdAG43APkcw-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, Kirill, "Kirill A. Shutemov" writes: > My guess is that MADV_DONTNEED get the page unmapped under you and > __copy_from_user_inatomic() sees empty PTE instead of the populated PTE i= t > expects. > > Below is my completely untested attempt to fix it. > > It is going to hurt perfomance in common case, but it should be good > enough to test my idea. Yes, that resolves the issue for me. > The real solution would be to retry __copy_from_user_inatomic() under ptl > if the first attempt fails. I expect it to be ugly. So long as it's correct. :) Thanks! Jeff