Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1320267lqm; Thu, 2 May 2024 11:00:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWE3AEQrd/GmV3qr89GuvFHXNWcgRQ3mxNz68p19DSXgLYl9fGoouVZmACvvyDU0ZHEMGt5g3PPQs3mjSrWNzyD3yBkIHXv7da80/UX8Q== X-Google-Smtp-Source: AGHT+IF1V/YMmZceZvOMStM7mZwHXc39lYc72i+Q7qWwrRKXb9YXmjsAmdoCp9+t1/KvBeI1omu1 X-Received: by 2002:a17:90a:a409:b0:2af:6ce2:bd2f with SMTP id y9-20020a17090aa40900b002af6ce2bd2fmr598284pjp.1.1714672824668; Thu, 02 May 2024 11:00:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714672824; cv=pass; d=google.com; s=arc-20160816; b=YLCjhmlH+4ztiRjp9HonIvf7p0O4zuYRqK3LVarkoS3HVjvxr3+0kisRJ2G14XADmA QmTtiR1tpQbeY1qe/aQNmUx3b6gwxbNftGCjHqhtghlp4tp4Zpn1G6Aa575YmST4nYk3 WnOThDleAsrEyNmFVeLmdhkjdcSZfjQGvBw98h7kt3fhrXH4A0QRnB+TBnKkLUF+l6AA /4nXr3Otv7pQz0dxJAdtfI5V7H1dV3bDuBMh/zRDLc+6woeh9wUxBbEyYrI/GW3o4k1K 9XtGjEtIm7PtiskpUAETtsBBtFVT6z0qJZjg1FQqdDwt7A4747wYZ3tS/BAMnUoR6wwb gxUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=7LZPlAU0Na4zXLABvS8zlJHgSdvsPBzs7Zba0Ak6em8=; fh=0dC4utT1/23qH+8PMueXK70Slb9lC4wAzpERdhM4VSY=; b=RKbn7OfaJq/DqqmGeffJ7e118MRx+YWfHP+vp7zpCAzQSTTfy+jyADavJv2cTAvST0 j6bGDzMgYB02frY2iTzSbwOc9ycQj4GM6Z4wuQT3+Ni1Zw6HfqrPSrX7YkqSE1G9B9pe EqmrbbBXQnmif8qUdnm7JPpBIzVyHheXDAuB3TkX9Fs7N8M81X2vchkCaUxVzplq6j/2 gc/7yv0yAtXA7vhbGMYaAKHCnDz18B7+KZRFGX3SXf5me6ACU5l114Iz1wzzfwFLSpn/ 8k5F2AdE3zOfpWogN87+rw060Tt6Fo1YPj4Dl/QDQY3p2SM5v0XGCUGYCmqZPzKr6Jjs UjCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-166818-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166818-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id a22-20020a17090ad81600b002b3d16c4f14si1229784pjv.153.2024.05.02.11.00.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 11:00:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166818-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-166818-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166818-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id DE1E1B22AD5 for ; Thu, 2 May 2024 18:00:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71DBD171668; Thu, 2 May 2024 18:00:13 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED057171068; Thu, 2 May 2024 18:00:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714672813; cv=none; b=i53exzSeloxaNCFPQsOy1bODzZuqUrd1ZDcPwPOIvfVPIdaLeWXzOPGPYd2RCmMrNhKymIyvxEk2JSvFxUh8QBdQfHwLxngmho+kpn7BxcF2L/n+1SrJIjNYmjWdA0vZbcXmSgr2YD/8j0kdcCKwdBfb2a0d24rOmGTgM9vLAMM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714672813; c=relaxed/simple; bh=BwXhwwffklxOe2+TlmFS93TXrpMJq9ig2rSZlYauX/M=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=S6D/zSaUMcPx5azwnNApvFPcsTnJEelGEUAxoN3+WXpf9SY6dRQa0tm3SoZihGPAqr2lIFwk+GrisLgEuidUz3TTE7/EvyBareRVDKM/ZEhqtYvTCRjtZU9bQdgGQ7UXJ1CI6cJfT/AxKbwkuoZz33VsgGkDfGHK1kFwlWHt1L0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1C20C113CC; Thu, 2 May 2024 18:00:10 +0000 (UTC) Date: Thu, 2 May 2024 19:00:08 +0100 From: Catalin Marinas To: Will Deacon , Mark Rutland , Anshuman Khandual , Andrew Morton , Zi Yan , "Aneesh Kumar K.V" , Ryan Roberts Cc: linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2] arm64/mm: pmd_mkinvalid() must handle swap pmds Message-ID: References: <20240430133138.732088-1-ryan.roberts@arm.com> <171449974870.639201.3165060270571039049.b4-ty@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <171449974870.639201.3165060270571039049.b4-ty@arm.com> On Tue, Apr 30, 2024 at 06:57:52PM +0100, Catalin Marinas wrote: > On Tue, 30 Apr 2024 14:31:38 +0100, Ryan Roberts wrote: > > __split_huge_pmd_locked() can be called for a present THP, devmap or > > (non-present) migration entry. It calls pmdp_invalidate() > > unconditionally on the pmdp and only determines if it is present or not > > based on the returned old pmd. > > > > But arm64's pmd_mkinvalid(), called by pmdp_invalidate(), > > unconditionally sets the PMD_PRESENT_INVALID flag, which causes future > > pmd_present() calls to return true - even for a swap pmd. Therefore any > > lockless pgtable walker could see the migration entry pmd in this state > > and start interpretting the fields (e.g. pmd_pfn()) as if it were > > present, leading to BadThings (TM). GUP-fast appears to be one such > > lockless pgtable walker. > > > > [...] > > Applied to arm64 (for-next/fixes), thanks! It should land in 6.9-rc7. I > removed the debug/test code, please send it as a separate patch for > 6.10. > > [1/1] arm64/mm: pmd_mkinvalid() must handle swap pmds > https://git.kernel.org/arm64/c/e783331c7720 Since Andrew merged the generic mm fix, I dropped this patch from the arm64 for-next/fixes branch. -- Catalin