Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp319528lqm; Wed, 1 May 2024 01:05:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVNW2zWsFOBEXoin/f6mx0JfSKD/y1uPQa9wD030k1YJb5/xt628azQI2vKXW72pO5bisfvTVF6toSKL4+MmepezKZhCmNlk9wrjurkng== X-Google-Smtp-Source: AGHT+IF8f78aibNKC+bL3ZhFb6A/DEhpZKmxxuR26Dbua4xYE/z4jKH1/t1somiRD1n+xoS8Wjyk X-Received: by 2002:a05:6871:80b:b0:22a:9d72:2cf6 with SMTP id q11-20020a056871080b00b0022a9d722cf6mr1902408oap.46.1714550731141; Wed, 01 May 2024 01:05:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714550731; cv=pass; d=google.com; s=arc-20160816; b=aBwXuSMY3Jg9ryjcMtTx3wpVRo5qmVLMZGBpGm6mI8kBBJDHyxuzB3FkKCYJuBaI1s 8ZQA1GIL8HgDPNcNG0Iv77dA6w7urcpSUWHAEfbxJV2G8tzCwKmVmycYLIKDncYNwg4i KrkdlgcW3sc1ZlDEi8qM2H1TaTyH4IXezOmJCt0ixB12QaAn3uQJAC1qQBb7TBP2dKGA uGTn37U+UlN34h0O4Z8NuV0247iOEZFaHv9Jff8v2FlCHCCNLvm+GqcD/XiYNK+W2jb8 ZM9UEOjwFmgorVP57iAM1D+9eQHHVvVMyaAeh0DuL3Qov97miFXEMcBCH8I1n82nKUwN A19w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=QWBN4582rISOUOFp5VrgxVeHZFGIumdhORUgbWo0Uho=; fh=U+BtM0747Z5gyDSNLwVnT5Ph7QOgu0MpBsY/jX20f2s=; b=HhXsoSDnRepf9IVR0foAl1Ovx9yf7mb07fp9bzbgLgJWXDTvoaMWE0dux2KWqbOK6x kU0YXzXz6Esj3l6qSQdJADSpUwBSemfgUB7MtvBtm2Rs6XPKNa6gXxeVrZ+4ewfmYbF2 bdkDbl9ayxDnojJauup8sFHDopXSQ6w8AHTVDt9nUK/xti7X5BqaY7WavioFxsBeKwhv URXiMPAAEnkGBQv4NAhOT0EZOMU5t25oNtsBnM9uXFZ2AKSNuHmYC6W40PBkeG3DEAeW apJMrHkLFM7Hy7GAM/BRhKtLkc1C49bx+HBB9vGJ0SPGiRckbOy7N0t8wjGppEPab+lU lKFA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-165023-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165023-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q25-20020a637519000000b005dcb793677esi21031443pgc.135.2024.05.01.01.05.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 01:05:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165023-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-165023-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165023-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id BA035284C55 for ; Wed, 1 May 2024 08:05:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 311294E1C9; Wed, 1 May 2024 08:05:24 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5F95D28DC7; Wed, 1 May 2024 08:05:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714550723; cv=none; b=NJLpnn+PWtbQpsLNhbJJc1BndKrtWoZiD1pM8dQCXJoZY0N6okw4Q8xLkUru1bXfnooT/PI4V9j0BdoKiuqPQiUAGcyxeIDS4oGpJ7hSWv86UMerEj1T8wc5dizDJbAhQg8ckTPAM5cTgCnDEJ7hwKlZ/IjPRPiQABXep3hcSic= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714550723; c=relaxed/simple; bh=2HevmY/Q4C4rLB+9s4SmfYOSFdV6Ae/J6fu9OaszjS0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=CYCMtWxzQORBTLOn3rRuBoPWRL9i6Aj9qgHsMBmtL5qQs19PaS45F4/IiGOscT4lI/27kZ4SGBze57SDubf9UX+fvFeJTrK3LOZZ4q0d4RyCZze0nOti8MFVPUCohTpcUje+JJAnCBAnj4BsbBEY5/ehzwDBFKYGpb8N5YkBLaE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 74D8B2F4; Wed, 1 May 2024 01:05:46 -0700 (PDT) Received: from [10.57.65.146] (unknown [10.57.65.146]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B9D663F793; Wed, 1 May 2024 01:05:18 -0700 (PDT) Message-ID: Date: Wed, 1 May 2024 09:05:17 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] arm64/mm: pmd_mkinvalid() must handle swap pmds Content-Language: en-GB To: Catalin Marinas , Will Deacon , Mark Rutland , Anshuman Khandual , Andrew Morton , Zi Yan , "Aneesh Kumar K.V" Cc: linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20240430133138.732088-1-ryan.roberts@arm.com> <171449974870.639201.3165060270571039049.b4-ty@arm.com> From: Ryan Roberts In-Reply-To: <171449974870.639201.3165060270571039049.b4-ty@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 30/04/2024 18:57, 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. Thanks Catalin! I'm guessing this will turn up in today's linux-next, so if I send the tests today and Andrew puts them straight in mm-unstable (which will goto linux-next) there is no risk that the tests are there without the fix? Or do I need to hold off until the fix is in v6.9-rc7? > > [1/1] arm64/mm: pmd_mkinvalid() must handle swap pmds > https://git.kernel.org/arm64/c/e783331c7720 >