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.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, 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 04B08C35242 for ; Tue, 11 Feb 2020 21:44:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B8665206D7 for ; Tue, 11 Feb 2020 21:44:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="N+Z19pYu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B8665206D7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 482ED6B0339; Tue, 11 Feb 2020 16:44:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 433316B033B; Tue, 11 Feb 2020 16:44:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 348D46B033C; Tue, 11 Feb 2020 16:44:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0029.hostedemail.com [216.40.44.29]) by kanga.kvack.org (Postfix) with ESMTP id 1B5E06B0339 for ; Tue, 11 Feb 2020 16:44:24 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C1231181AC9CC for ; Tue, 11 Feb 2020 21:44:23 +0000 (UTC) X-FDA: 76479175206.03.time04_436cc79cf713a X-HE-Tag: time04_436cc79cf713a X-Filterd-Recvd-Size: 5278 Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Tue, 11 Feb 2020 21:44:23 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id q8so13285739ljj.11 for ; Tue, 11 Feb 2020 13:44:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=iJsQtWAVJQgVcwr8e6chnpuawEOpT3Oq6mui072DoWo=; b=N+Z19pYuHNoxqpnSvnOGkxrgpI55xQZ34wBo7L+MIOpPkVFsWEn2fjL/Dw8dsel2An grbaUeRHF4YakXNHqdG3SbVNRn0gblYGyyVbL42K4e6bGC1o+XLiS5Ldp1EmDPV10isN tsSV4ij0CU/QE8xpoYvehsCKe80yHehiVMA/qXdxk8u/rSRuEAt2SYuxnnFGFyJdECcL PJaFSeF/ffc3YETcdyP99pam1TmK68DrnBQ6vWb+JfQ7k7mR4pSbrcL5B7Lk32S1v7TB z2otmuniANeRcKWQUBy1HyuVYuGc/O1ENgGx0lV5icLJzfG4ypzfNy2uj15CAtDGalHX uvfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=iJsQtWAVJQgVcwr8e6chnpuawEOpT3Oq6mui072DoWo=; b=kj7mjOf2EyoVHgFca2ZJBzy4P0S2NGfyrqdD2wxeTbcMJKj363QnSB9hLEOi7q+Ldh VpNzT8xaD9SdTgYTtJA6UQPTgmkKDcKjT0wczSijYL3WCbewxs03au3U6u2w7ygaTSUg kkk0W+07GCiYPpl4oQ0umNVSr69H/Trxe4Y1/tZJUK1O3Q7iSH+jSinG2jKDznuCLvPF FhpYayFBpUT1RKNP8U+MoJMzaf3h3femQGNQrY8+hsZJsdGsqqDANnk+tLkk/FBiolT2 3WLU6d8nL/p8gl+gcb1AA5s90VLR6filLarUgCH/4Xah5QXdtXeFtPlE9dW+zOxj9DnS kDOg== X-Gm-Message-State: APjAAAUPNk/frwEdeJ6KnF/4c0SUGiUJIbRdf9pXJdgydO4RFDLQbEOQ 2p1owdwcWAFjp9R8Ad61ZK7d5A== X-Google-Smtp-Source: APXvYqzCIn7TDPqtNvPRwUUpR7YozkAxLOUqTLw0B0eZ6QNtrf8Pcf2qaZayWxqQgYpkcp49ooBUJA== X-Received: by 2002:a2e:9748:: with SMTP id f8mr5809377ljj.178.1581457460900; Tue, 11 Feb 2020 13:44:20 -0800 (PST) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id g15sm2831553ljl.10.2020.02.11.13.44.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Feb 2020 13:44:20 -0800 (PST) Received: by box.localdomain (Postfix, from userid 1000) id 49185100E99; Wed, 12 Feb 2020 00:44:39 +0300 (+03) Date: Wed, 12 Feb 2020 00:44:39 +0300 From: "Kirill A. Shutemov" To: Jeff Moyer Cc: Justin 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") Message-ID: <20200211214439.v6bowbkyienrwtdd@box> References: <20200211173352.wjm6govzcqy355y7@box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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: On Tue, Feb 11, 2020 at 12:55:50PM -0500, Jeff Moyer wrote: > "Kirill A. Shutemov" writes: > > > On Tue, Feb 11, 2020 at 11:44:06AM -0500, Jeff Moyer wrote: > >> 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. > > > > I cannot explain this. There is no locking to prevent the same scenario > > before. It might be an timing difference. > > > > Could try to put a delay before the copy to make race window larger? > > I reverted my change to the reproducer, and now it triggers the warning. I'm not sure I follow. My understanding is that you failed to reproduce the issue with 83d116c53058 reverted and WARN_ON_ONCE() placed. My ask was to try to put some mdelay() just before __copy_from_user_inatomic(). The mdelay() may help with reproducing the issue on the old code. If the bug still fails to reproduce I may misunderstand the source of the bug and need to look further. -- Kirill A. Shutemov