From mboxrd@z Thu Jan 1 00:00:00 1970 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 11BE02D8790; Tue, 15 Jul 2025 13:25:28 +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=1752585928; cv=none; b=msalGCO6gyVOMQYmkESiefSUqlxEBRVUm438L2UnQkIRjm1Tn0mFx4281Uh2eP+uw8XlsF/hDISpDK7swCxMYX7JpnI70Mgezc4BLiLWCXiYbRfRYcRAGK087tHgI7gRIo3onn7R4UJW7aHqF7oyrHJoqPwdZYJK4V835yiFmDI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752585928; c=relaxed/simple; bh=kSe7VuCrMzim2nUHrgOiBwMt8ZJaslVhSDqt+WVBXlU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MIYAHLRuUxTK1c+Zd2bvnMY7YJxWWB7ecmMeN3DZI5DPRaSHy2X7DYCfHVBGcXPDZX0KtuIab1EF7XaxHv0rhQZ3DnHbrRW+K37bXx582haEE7g5B5hHllk8plE7oW07vOpUvr0VEky07SxUIZBzBjz/rcsQnUnVLdH3W24ZTXI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=a6/Gr4kV; 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="a6/Gr4kV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BF7BC4CEE3; Tue, 15 Jul 2025 13:25:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1752585928; bh=kSe7VuCrMzim2nUHrgOiBwMt8ZJaslVhSDqt+WVBXlU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a6/Gr4kV3CaV5Bb9l8wQ4Y9WdZFbg0ScbNSc8/unEKdF7t23p8zMBQBN/4nnEha0W hdjcGLviI1D92rQm2u3RUj+QXq/qvrvHVS52wzRurF0wamqPOgVOk1qZ9fTOEce9Ks H06ezuuSn6PzMVKvVvEvUKUAerUep5OGjVRpWb8Q= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Vitaly Chikunov , Dave Hansen , Jann Horn , Dave Hansen , Oscar Salvador , David Hildenbrand Subject: [PATCH 6.6 060/109] x86/mm: Disable hugetlb page table sharing on 32-bit Date: Tue, 15 Jul 2025 15:13:16 +0200 Message-ID: <20250715130801.285237875@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250715130758.864940641@linuxfoundation.org> References: <20250715130758.864940641@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jann Horn commit 76303ee8d54bff6d9a6d55997acd88a6c2ba63cf upstream. Only select ARCH_WANT_HUGE_PMD_SHARE on 64-bit x86. Page table sharing requires at least three levels because it involves shared references to PMD tables; 32-bit x86 has either two-level paging (without PAE) or three-level paging (with PAE), but even with three-level paging, having a dedicated PGD entry for hugetlb is only barely possible (because the PGD only has four entries), and it seems unlikely anyone's actually using PMD sharing on 32-bit. Having ARCH_WANT_HUGE_PMD_SHARE enabled on non-PAE 32-bit X86 (which has 2-level paging) became particularly problematic after commit 59d9094df3d7 ("mm: hugetlb: independent PMD page table shared count"), since that changes `struct ptdesc` such that the `pt_mm` (for PGDs) and the `pt_share_count` (for PMDs) share the same union storage - and with 2-level paging, PMDs are PGDs. (For comparison, arm64 also gates ARCH_WANT_HUGE_PMD_SHARE on the configuration of page tables such that it is never enabled with 2-level paging.) Closes: https://lore.kernel.org/r/srhpjxlqfna67blvma5frmy3aa@altlinux.org Fixes: cfe28c5d63d8 ("x86: mm: Remove x86 version of huge_pmd_share.") Reported-by: Vitaly Chikunov Suggested-by: Dave Hansen Signed-off-by: Jann Horn Signed-off-by: Dave Hansen Acked-by: Oscar Salvador Acked-by: David Hildenbrand Tested-by: Vitaly Chikunov Cc:stable@vger.kernel.org Link: https://lore.kernel.org/all/20250702-x86-2level-hugetlb-v2-1-1a98096edf92%40google.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -128,7 +128,7 @@ config X86 select ARCH_WANTS_DYNAMIC_TASK_STRUCT select ARCH_WANTS_NO_INSTR select ARCH_WANT_GENERAL_HUGETLB - select ARCH_WANT_HUGE_PMD_SHARE + select ARCH_WANT_HUGE_PMD_SHARE if X86_64 select ARCH_WANT_LD_ORPHAN_WARN select ARCH_WANT_OPTIMIZE_DAX_VMEMMAP if X86_64 select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP if X86_64