Message ID | 20230602092949.545577-5-ryan.roberts@arm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp903942vqr; Fri, 2 Jun 2023 02:42:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4JRRuzUM87WLhnJRsEY3pRrfg0B2ehAc5FigoQpyEJtppgXwv3xOneAOyDNk684ZVFdche X-Received: by 2002:a92:d581:0:b0:33b:151a:e29f with SMTP id a1-20020a92d581000000b0033b151ae29fmr8643459iln.11.1685698945626; Fri, 02 Jun 2023 02:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685698945; cv=none; d=google.com; s=arc-20160816; b=n1Ld5CGXxTGbnQQCnHFvVPl1GO+Tt5U1GjIlC3dTJLrC8EpFGPjF+Mk0ARrEkRMymm hh/KiWEosu9jPu0m/aU5Kh+ibUk215Yw3fUAexqzX8NMvLToCi1kIg4gbGoXI7GcnPAV tBeXTcy9fg0hU+BQyc6QHsn5Go8TDALhncMIOIA7izTTFVswVw+kr0MAVpO7YBsamBiK qS4VR41e4ZbEV5NMIZC+7o7mIsFrxw3mbr0BJv7ZX6sQc0gdyYcLWxDf8LcCJJR7VRE1 s8mConZvfF7E8uJka97KICs/B4C1P5m02ak+xpt2Jz+ik6rs6eFI4w/wRBfVXsKnzIuC dDVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=vZ8R5MX0YBLxMMX9FnLRmjkoG+ZGaABcPpi932QFLAY=; b=PJgPS9ig6gQBIjA/09+it5I04h+ta/XtQE4WApt7T2belmT6NNjsKcsWVHJoJ6VLYm J9JrwyZWDMwsNiAKupYhdKwc/W9rHMLwEII/b0kgHA63BKyVxgMb0uXykxKi7mLLFsfG LBRlN3iTbuTSnUS50XUpr1j4z6XuvZQZFqUoqeqsrg7VWvUEFEWjcxNG2/reSEHQjNWB Adt2g538ASA4xNgkvHJLpSvwL+LHgumw0Phfn4KID4ZlKg8LCd0BDZpX964lpK/VN9HK lf7FmNFr4wZEwUv2/Tc/khDPtVK1QObQSK5SmWi9fpnlucBmP/hCxkn5iCzAXytEcXeQ Qxdg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v189-20020a6389c6000000b0053f2601e5aasi724660pgd.195.2023.06.02.02.42.13; Fri, 02 Jun 2023 02:42:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235033AbjFBJb1 (ORCPT <rfc822;limurcpp@gmail.com> + 99 others); Fri, 2 Jun 2023 05:31:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235012AbjFBJam (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 2 Jun 2023 05:30:42 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 149F910F7 for <linux-kernel@vger.kernel.org>; Fri, 2 Jun 2023 02:30:12 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0728A176B; Fri, 2 Jun 2023 02:30:57 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D0E1D3F7BD; Fri, 2 Jun 2023 02:30:09 -0700 (PDT) From: Ryan Roberts <ryan.roberts@arm.com> To: Andrew Morton <akpm@linux-foundation.org>, SeongJae Park <sj@kernel.org>, Christoph Hellwig <hch@infradead.org> Cc: Ryan Roberts <ryan.roberts@arm.com>, "Matthew Wilcox (Oracle)" <willy@infradead.org>, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, Lorenzo Stoakes <lstoakes@gmail.com>, Uladzislau Rezki <urezki@gmail.com>, Zi Yan <ziy@nvidia.com>, Yu Zhao <yuzhao@google.com>, Mike Rapoport <rppt@kernel.org>, linux-kernel@vger.kernel.org, linux-mm@kvack.org, damon@lists.linux.dev Subject: [PATCH v3 4/4] mm: Fix failure to unmap pte on highmem systems Date: Fri, 2 Jun 2023 10:29:49 +0100 Message-Id: <20230602092949.545577-5-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230602092949.545577-1-ryan.roberts@arm.com> References: <20230602092949.545577-1-ryan.roberts@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767583457690167480?= X-GMAIL-MSGID: =?utf-8?q?1767583457690167480?= |
Series |
Fixes for pte encapsulation bypasses
|
|
Commit Message
Ryan Roberts
June 2, 2023, 9:29 a.m. UTC
The loser of a race to service a pte for a device private entry in the swap path previously unlocked the ptl, but failed to unmap the pte. This only affects highmem systems since unmapping a pte is a noop on non-highmem systems. Fixes: 16ce101db85d ("mm/memory.c: fix race when faulting a device private page") Signed-off-by: Ryan Roberts <ryan.roberts@arm.com> Reviewed-by: Zi Yan <ziy@nvidia.com> Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org> --- mm/memory.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/mm/memory.c b/mm/memory.c index f69fbc251198..ed429e20a1bb 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3728,10 +3728,8 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) vmf->page = pfn_swap_entry_to_page(entry); vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd, vmf->address, &vmf->ptl); - if (unlikely(!pte_same(*vmf->pte, vmf->orig_pte))) { - spin_unlock(vmf->ptl); - goto out; - } + if (unlikely(!pte_same(*vmf->pte, vmf->orig_pte))) + goto unlock; /* * Get a page reference while we know the page can't be