Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp4604lqm; Tue, 30 Apr 2024 10:58:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXVNJ6T2t8IjidUFEgoeI9B8IAoMQB6o6f/2ikJuAUCMFbHt0I5+FYRFIQccIqzsGOytrK1mupYuOKsEXV3bQbUk2tJILqNufhxd0XOpA== X-Google-Smtp-Source: AGHT+IEcUHd1aUZ8u6mHMFkyPbkfKD0U5bRkD5ex1t7oL/+H+BmLsCR4P2zBXRt5GoqURrnIZMsO X-Received: by 2002:a05:622a:308:b0:43a:ffb9:e7e0 with SMTP id q8-20020a05622a030800b0043affb9e7e0mr22458qtw.38.1714499884684; Tue, 30 Apr 2024 10:58:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714499884; cv=pass; d=google.com; s=arc-20160816; b=BuUNxaZP7WpJ6ubKuXlkx1Cccz++BNSBNo55f3MLoZFV51uiZK5/W6rk4JrMaRBdUA 7OVExqOtlsB9K2l3J/tkPV4RK8wBVG8+qwCaUAYo/6C6rwLrtkAXXjFRbmwbCRuVcw8R 2ul9YOFRXVft8zmhaEsocDuJPt3eED3kkqDNuQLh9cDtgdVpJBgX8Az5+tXQB1ZuLgZE EZ5cA4cciZE2zF2Jk3QlnAxd8yNsrOGGo4xmp/8ZZahzgMiToMullVlbn58QbXt7+AlE SP84iI9PmgTleTpNNJSrho9+JBXZMRT8zJTVTz3J85SIKbbuiJg7RhnlZkpsq5i5nMgT bGBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=tqgUh1elBIVyrj4Hw2oKmYVwb+olCnEXADSxtbZU/Is=; fh=0dC4utT1/23qH+8PMueXK70Slb9lC4wAzpERdhM4VSY=; b=s75l1L32pNoJA59SCjY8a9PO23OZston/cl+jaDpA4hIBijlb5z5Megyo7usu01uC7 9IBZvdpKARuI9Jv2w6nc/n65IiTv34eJROaj5mfeFeocjcTieLrAVqc93rR1Ah+1U48V t1nCWS1Aj4FHJ3Kyq4xXoccTxHFSWg+TndMbsHrk208/137fr8++NKE0hJ4/SwX3GmOf ftT9uHfcc0ASdTfytHcjvKh7eDhjTJzQJTHXT17G+MrrhPDUs98UIWEPupOj4BxsQTob u1cL/QutmkH/prHGYVPKWf2ySmJMJjtcxE/QMBOK18qSoP3XCF7eh45ofDN4Rs+vtizl ER/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-164559-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164559-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. [147.75.199.223]) by mx.google.com with ESMTPS id t38-20020a05622a182600b0043ae59d2679si5213614qtc.778.2024.04.30.10.58.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 10:58:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-164559-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-164559-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164559-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 68FA61C23081 for ; Tue, 30 Apr 2024 17:58:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA10B181B87; Tue, 30 Apr 2024 17:57:57 +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 2E33D180A6E; Tue, 30 Apr 2024 17:57:56 +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=1714499877; cv=none; b=Yb0OpG+fr+PkNh1+T42210qtSmd+mMzLDoQxTN8iekKwa7JFghd8VdTe4IAxKbUaKo4rnsuz5Ri3tLgAdyRagXt4hMdHA9ERxLBjtTr9anA1GIfyyJh/OXisE81urVySW+zsGCF9x5BN+M6B8vNERfBDC+r+0TAQ6BZDBRWoYXY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714499877; c=relaxed/simple; bh=1mnPuEmB9SM0+xUMK/nXa6i0m18KSVJYhpah7UrSo28=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=BapmO/JR+c1AB02CDN6rs414iHCKM+dPUkkBcwkLfsIuOgmtjZjW/LhcY8a6Ok4q30+6+7q14gTy/O9YQQA5HCEa0jfZxj9UEi34/9ASJHtzUAGrWgqS3DR6BDCmS3EEczW84r3d6/br30lC75VPZODq/EsFpFSIJc9Kmacg8tE= 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 81E97C2BBFC; Tue, 30 Apr 2024 17:57:54 +0000 (UTC) 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 Date: Tue, 30 Apr 2024 18:57:52 +0100 Message-Id: <171449974870.639201.3165060270571039049.b4-ty@arm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240430133138.732088-1-ryan.roberts@arm.com> References: <20240430133138.732088-1-ryan.roberts@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="utf-8" Content-Transfer-Encoding: 8bit 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 -- Catalin