From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9EC69C54FB3 for ; Mon, 2 Jun 2025 15:09:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=W4mXnGww/ihsjoYGnRHuZViwsaGAt3e7Y+Jqz8jRIHM=; b=Mv67DxVbhvg6To+F7XSC//U70T DGVLlahrmoMEsQolnJxY84Ooj7Fb5lsptnI7abkyR9Zfd5jnGEZY0mekggQPCHljrUfA8wzpqoWQ7 Fz5EnVd8psLJzLUDMC/UxDqua+Pu9rcoCAA+qxYBfBvv5pAApAmAH1dQxcYnma2+nRMFSnjkRujWK NGS/rQgvl1ZIhSyXROgdfju68CMCMcITGOjRJRHiSOEzjt2yvZbC5thXeUbzKxO4mnDTsOZcs2ZnI CRrtMw39XpgheW+qpboFiNRlqjZOnzdbWowsmxSL9HC8tc+5g4zNkVNOCiY7bEkl0magdzLZAO7ED ksMKT5AA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uM6mk-00000007iQY-1zuw; Mon, 02 Jun 2025 15:09:10 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uM6kZ-00000007iCB-0vrC for linux-arm-kernel@lists.infradead.org; Mon, 02 Jun 2025 15:06:56 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 32841A50231; Mon, 2 Jun 2025 15:06:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86E61C4CEEB; Mon, 2 Jun 2025 15:06:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748876813; bh=cY2ny3TSupB+xy+obsMLXMCKNtWfGtp62MypO7UTF0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lL1CpPzFkinb2vRs2lb9aNLUS8R5BWAk6QOu/HPTi2ezamgScZ99Xe3tlj3f53x5D 7q88f955Pc6r7+97lziIlnECFfpg9ynt5gWhWYe9rctStADHwlZsqBP3pQAkFnlePA uIWjrNPTyvHhQ7Ie9OyUpx31p3Uxyp0wThznWk8A= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Will Deacon , Ard Biesheuvel , Ryan Roberts , Mark Rutland , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Anshuman Khandual , Catalin Marinas , Sasha Levin Subject: [PATCH 6.1 083/325] arm64/mm: Check PUD_TYPE_TABLE in pud_bad() Date: Mon, 2 Jun 2025 15:45:59 +0200 Message-ID: <20250602134323.154358758@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250602134319.723650984@linuxfoundation.org> References: <20250602134319.723650984@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250602_080655_323561_1121276B X-CRM114-Status: GOOD ( 13.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ryan Roberts [ Upstream commit bfb1d2b9021c21891427acc86eb848ccedeb274e ] pud_bad() is currently defined in terms of pud_table(). Although for some configs, pud_table() is hard-coded to true i.e. when using 64K base pages or when page table levels are less than 3. pud_bad() is intended to check that the pud is configured correctly. Hence let's open-code the same check that the full version of pud_table() uses into pud_bad(). Then it always performs the check regardless of the config. Cc: Will Deacon Cc: Ard Biesheuvel Cc: Ryan Roberts Cc: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Ryan Roberts Signed-off-by: Anshuman Khandual Link: https://lore.kernel.org/r/20250221044227.1145393-7-anshuman.khandual@arm.com Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin --- arch/arm64/include/asm/pgtable.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 1d713cfb0af16..426c3cb3e3bb1 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -677,7 +677,8 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd) pr_err("%s:%d: bad pmd %016llx.\n", __FILE__, __LINE__, pmd_val(e)) #define pud_none(pud) (!pud_val(pud)) -#define pud_bad(pud) (!pud_table(pud)) +#define pud_bad(pud) ((pud_val(pud) & PUD_TYPE_MASK) != \ + PUD_TYPE_TABLE) #define pud_present(pud) pte_present(pud_pte(pud)) #define pud_leaf(pud) (pud_present(pud) && !pud_table(pud)) #define pud_valid(pud) pte_valid(pud_pte(pud)) -- 2.39.5