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=-2.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 382C7CA9EC0 for ; Mon, 28 Oct 2019 12:08:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DE4602086D for ; Mon, 28 Oct 2019 12:08:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="byq6KJZB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DE4602086D 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 761A06B0003; Mon, 28 Oct 2019 08:08:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 711D16B0006; Mon, 28 Oct 2019 08:08:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 600FF6B0007; Mon, 28 Oct 2019 08:08:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0061.hostedemail.com [216.40.44.61]) by kanga.kvack.org (Postfix) with ESMTP id 3CCD66B0003 for ; Mon, 28 Oct 2019 08:08:27 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id B0751181AEF21 for ; Mon, 28 Oct 2019 12:08:26 +0000 (UTC) X-FDA: 76093071012.18.jewel42_49a5ce7a2943d X-HE-Tag: jewel42_49a5ce7a2943d X-Filterd-Recvd-Size: 5091 Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Mon, 28 Oct 2019 12:08:25 +0000 (UTC) Received: by mail-lj1-f193.google.com with SMTP id m7so11057102lji.2 for ; Mon, 28 Oct 2019 05:08:25 -0700 (PDT) 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:content-transfer-encoding:in-reply-to :user-agent; bh=6kDoXt82CZljf+qYADfgJAkcPTlQsFN1MjjiwFG1/RM=; b=byq6KJZBAX2DLAVCixgRz0a3foTiHOcfMMRSGNs4kAATIezC3V3fo+VoYYGZyk0SCy /+wiTzN6adLGc7qy8PsJuczixruDVfdrJcQt4nYTlRIU9NooFXE3BVZfqTeXO+x7iLoP MODzSsRG5P3GseVPZ1gMt9mr8kDY+nZqe2q8N1dchBW1vIkaOWi2set3Pq77bKpLqd7g m8vtzdHLILeZun5kvamZXLaG69F65q2i5/OPrVjq7iB4TsGSZMS+BZldDFiqzGio6zw2 ITl8my0VvV0AhZ4O8ER8IfkKS9kTsqAQGeMpmFoHrpHJFUISIvjd1MYpKB11WzILz4MU BxtQ== 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:content-transfer-encoding :in-reply-to:user-agent; bh=6kDoXt82CZljf+qYADfgJAkcPTlQsFN1MjjiwFG1/RM=; b=hpBsy8oGF6pm85dwy6upcY/Ush76krVMAT3ux/Mn2A0RyGkEiRE1B3pcMSCgg46nl9 Ci3AQThVlJEc6zHrUFO1B3BvWl/PDSg/w2Kny5Raz1GdAUPTfhzj8DPLZrWY9vIL1e2C AeBamaVQHzl1tNFk/PV68SP4OzephvHXx6/71fpIRo+1vc7iLb41QqROIbDKj2R1fHMq vMuTbayPvlQjHgujabXF+tpZZlNfuBCK8iEpOyhzHLEelL2UpRc31QN5LRs21kCrR1zP mKMa/+KegjvVrvaqav8Th7o+8+xU+6glQ4pWdVBIdEecYxLePNbwCtY1EhuCiCoWyCmL DQnw== X-Gm-Message-State: APjAAAWgAvJArKdKBoeBlGWzvtQwA8vbmQTwzzyp34OJIYr+KNT3o7ZU kNqzR/ZUJahelXzad+kSUtEWOA== X-Google-Smtp-Source: APXvYqzYukSwZMFq5wv0NTuGkMM95KOM3+uXAMOBIFQx7Db98+LH3OzhK61OsWzwhG6Vw99QXDauAQ== X-Received: by 2002:a2e:9ad0:: with SMTP id p16mr11568746ljj.179.1572264504500; Mon, 28 Oct 2019 05:08:24 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id k9sm5245781ljk.91.2019.10.28.05.08.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2019 05:08:23 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 78EDB100242; Mon, 28 Oct 2019 15:08:25 +0300 (+03) Date: Mon, 28 Oct 2019 15:08:25 +0300 From: "Kirill A. Shutemov" To: "Figo.zhang" Cc: "Aneesh Kumar K.V" , Andrew Morton , "Kirill A . Shutemov" , Linux MM , LKML Subject: Re: [PATCH V2] mm: Recheck page table entry with page table lock held Message-ID: <20191028120825.mmlfputxj3p44yxh@box> References: <20180926031858.9692-1-aneesh.kumar@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 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: On Fri, Oct 25, 2019 at 11:13:58AM +0800, Figo.zhang wrote: > Aneesh Kumar K.V =E4=BA=8E2018=E5=B9=B49=E6= =9C=8826=E6=97=A5=E5=91=A8=E4=B8=89 =E4=B8=8A=E5=8D=8811:19=E5=86=99=E9=81= =93=EF=BC=9A >=20 > > We clear the pte temporarily during read/modify/write update of the p= te. > > If we > > take a page fault while the pte is cleared, the application can get > > SIGBUS. One > > such case is with remap_pfn_range without a backing vm_ops->fault cal= lback. > > do_fault will return SIGBUS in that case. > > > what is " remap_pfn_range without a backing vm_ops->fault callback ", w= ould > you like elaborate the scenario? > is it the case using remap_pfn_range() in drivers mmap() file operati= ons? > if in that case, why it will trap into do_fault? Because there's no page mapped there during the race. > > > > cpu 0 cpu1 > > mprotect() > > ptep_modify_prot_start()/pte cleared. > > . > > . page fault. > > . > > . > > prep_modify_prot_commit() >=20 >=20 > i am confusing this scenario, when CPU0 will call > in change_pte_range()->ptep_modify_prot_start() to clear the pte conten= t, > and > on the other thread, in handle_pte_fault(), pte_offset_map() can get th= e > pte, and the pte is not invalid, it's pte is valid but just the content= is > all zero, so why it will call into do_fault? >=20 > in handle_pte_fault(): > vmf->pte =3D pte_offset_map(vmf->pmd, vmf->address); > if (!vmf->pte) { > return do_fault(vmf); > } This case handles the situation when pte is none (clear) or page table is not allocated at all. --=20 Kirill A. Shutemov