From nobody Fri Dec 19 00:03:20 2025 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 1330A225419; Mon, 2 Jun 2025 14:55:33 +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=1748876133; cv=none; b=DSDO4J0rg49hF4JqeNgxmvtf4OVXPNXx6ACUNC3XPU0LkAF+ErLXNmB6AMwJeAVsGCqXU6swLRhc0bhVPqWr2G8e0tuvETupNEd7aqklO3Ken/w00Eya66K681pAeWl46Drf5uCkjNt/vvavz8et9Xs61X55mgb5VUQ+sfh4+4I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748876133; c=relaxed/simple; bh=n7FXRIlvdX+k0OorLeiytXznOYDzrxzd4eMJQ/3DAf4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J/3Eid5nXOkD8ulZByEhxX40WMxdgSpGB7KP/QtENW7EuwyOd2OcfPHma2dNsB4vd+3jwL9U3TiR5OwDzcVh9Qiq9iAgpAsl7nvZ8NHUdxYe+lvT6krOobRl6T/yWq3M96nO/hWYJnc6QWTP3jbM22tCyWh1Sjpj/xYKRQmPx8Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XhZ+/M83; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="XhZ+/M83" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8ED7CC4CEEB; Mon, 2 Jun 2025 14:55:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748876132; bh=n7FXRIlvdX+k0OorLeiytXznOYDzrxzd4eMJQ/3DAf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XhZ+/M83l5jfTtYQWIVovTJmFdu26ho4fmt7Ium+mKlm74M+P7i7IEm20pPQLSX6p jOnYvzqEU9WHefaJuvdjfSNhfyau2F7HYpss0l/EfIrE6TM/5o3ymGyjdUe2o/oTFU DwbOGo9WRde/uOMfijAMc00mmTW80i6HmQr7A7hI= 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 5.15 054/207] arm64/mm: Check PUD_TYPE_TABLE in pud_bad() Date: Mon, 2 Jun 2025 15:47:06 +0200 Message-ID: <20250602134300.870526061@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250602134258.769974467@linuxfoundation.org> References: <20250602134258.769974467@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 5.15-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/pgta= ble.h index b5e969bc074d3..a0bfa9cd76dab 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -623,7 +623,8 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd) pr_err("%s:%d: bad pmd %016llx.\n", __FILE__, __LINE__, pmd_val(e)) =20 #define pud_none(pud) (!pud_val(pud)) -#define pud_bad(pud) (!pud_table(pud)) +#define pud_bad(pud) ((pud_val(pud) & PUD_TYPE_MASK) !=3D \ + 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)) --=20 2.39.5