Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp364449lqm; Wed, 1 May 2024 03:04:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWPU+vLWKQfmht3GrZtEFHfkPD40lEG3EOToOh5a9I/U6R1K3JCOPiXnl14wfO6Ypbuyx5ZALi6oKxMNB6Q7fMxotfy6+Tktt42lWXiCg== X-Google-Smtp-Source: AGHT+IEoiowSIWD7k2fX8xrvnrfMvqdEVKuRU5J+3CysTOWO6wpPaghwWqnorqbJ91+Uml4wkCfr X-Received: by 2002:a05:6214:c8d:b0:6a0:b705:27db with SMTP id r13-20020a0562140c8d00b006a0b70527dbmr2113913qvr.13.1714557897347; Wed, 01 May 2024 03:04:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714557897; cv=pass; d=google.com; s=arc-20160816; b=dK22aSnIxHYz803pdvbgn+U7onWL+kNfx+CYr9Gi1SL9tFp/ShvJyouZrBHHEtk/O9 PzJSbSs12UdLuFVdqgmBQloY/zqHKIOL/DFzry6OZUR0ObTSJ+7iqwuP/W3TWrJvsVL/ SwDc7TKwpcxaoa+aLK3VpgxMX+gpw6jJiJtGtfk7T//Nc+uDpMfAQhdAuWKKblGdV5Y2 dNq7KhDJvTVp0vLEnMRtIdnKlO5kyCxttf+aaLRIZJeJB6/WuUPANViZeEwxX7Jhj0KB jPFDh5TG6oalvPLuCaToqesuYBQVdADRv2OQWjSS6K7kXtNO3ptlBttRIlcu2dClf3nm XmZg== 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=sR20Qi6ZHUUs2SVUrKl7hNsfJkxOFXcib5Ksy5KjHO4=; fh=xm49Klp/1nZMzYRmtMlJOXl2c/Dw58588tMaaTUgWts=; b=vjXI4dTFD2VUnxbHhxDKqLJMM1p4pDbh7im47wwQRjjTC1Jaw+NS4OqvvqziF/2JN/ 3IwwzrADhLfm2xG4/imcg+3cWAwbB1YBsf2YPQ0y+p5EQfIgGTnFqmf8yBid1e2/NPF7 RvUusRMj85l2ySuX8GGZflXAPebeC5P9FZUkrWAYwRuHNG3NGWoSMerTijnWIcJP7HKh gudpq6CLWjiYTqtXfXu6VFRqZuPCr6vDZCdYZgFN7OpoW4OnRrV010tqk3dFCOfSQcfk QBBQGOy3bAJ3hFvPfgaTqU7O/g1tjh4i75X/iaKuY1sdLBQs8WjTo+rzBZKdtzTJUsPr w3cg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-165121-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165121-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id kc26-20020a056214411a00b006a0c56b86besi2022830qvb.554.2024.05.01.03.04.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 03:04:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165121-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-165121-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165121-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 14EA91C23334 for ; Wed, 1 May 2024 10:04:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 63EAB524DD; Wed, 1 May 2024 10:04:50 +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 DE2B626286; Wed, 1 May 2024 10:04:49 +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=1714557889; cv=none; b=aYr5fJ7JvuYc2H0MeWBK33x1aBl7BXFe+Ozf5cqW6D5KXek4qdZCWvvAd4e8IahSpq+RtpmsojO1JdWMZ3aWhRfA7qBYr2Gy4kQMnp+mAqdpW45ls5QQIxds6+weakLXumKliNi8gY/RhJXUJ6FhoIvkb9VHtdFKRCku/Gu/GoY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714557889; c=relaxed/simple; bh=6acgbOkRAMHlRghsM7KyV6HLqiinUNzYGGeLgespLvY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=p0umhST4EeRZv+LsXE2fsZFQt8e8YtZySkDQ2qQnDNS9FHIv75Usgf2FgyZg4GaK3DQowa2LQtEsza0cfbnoEVgyxla8xStN4AHVCwAmP8LL4nPgPwoJZhlEku2W9IhRkUrqYELTPLWB55oYn8fpkfQ/9tC+Nu4E3JwLFF79yrU= 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 3DA12C113CC; Wed, 1 May 2024 10:04:47 +0000 (UTC) Date: Wed, 1 May 2024 11:04:44 +0100 From: Catalin Marinas To: Ryan Roberts Cc: Will Deacon , Mark Rutland , Anshuman Khandual , Andrew Morton , Zi Yan , "Aneesh Kumar K.V" , 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: On Wed, May 01, 2024 at 09:05:17AM +0100, Ryan Roberts wrote: > 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? It looks like we don't push for-next/fixes to linux-next, it's short-lived usually, it ends up upstream quickly. I can send the pull request later today, should turn up in mainline by tomorrow. You can add a note to your patch for Andrew that it will fail on arm64 until the fix ends up upstream. It's a matter of a couple of days anyway. -- Catalin