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 0B2DCC2C8 for ; Sun, 9 Mar 2025 10:34:30 +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=1741516470; cv=none; b=EthtIVBpjFEFRD+DC6l2he+5dquHSb7DdiGSPILLeR69Nx7JSCttLimqREoMZXU1cauJsqLazemp0mgspkNkoT9mAqlltEzg7wJr4fHsaLz54T406NxAt8urOlrP+rywABqCld2I/xU+zlxpaDb4OpLnNlnlq0/7YfddR8mTfCk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741516470; c=relaxed/simple; bh=CniN89i8FN/r5diOHtwr9o4hqKKkXYlHNB3/iWSf+10=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=G6c3/CCt486HQ2LL/3ZkgnjftLRMcK4e9DpVYkxOynRcmMxq7/OeXeoIszwCWYFBjOlm3X/UF35XZyIkYDXesxXVxVIII57T3a6g28KjipMaUK/WDZt2ExI/2dIkfi2NNTKntw4e28aBkjYK4PKuCnzE5BFNz5v4LE0r9HPzjSU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=NPhepQXc; 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="NPhepQXc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89393C4CEF0; Sun, 9 Mar 2025 10:34:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1741516469; bh=CniN89i8FN/r5diOHtwr9o4hqKKkXYlHNB3/iWSf+10=; h=Subject:To:Cc:From:Date:From; b=NPhepQXcOJiEcrEhIqsov+yWsbQ0Vz/oO7cM/BB6Sqy9CxwBHaerZJQsHRKiZbGiC PqCApW9bAN1CkLiCO40+AM4+XgG6sUUrnGpmS4ZRhTdTfIBB9lYFrgiAOSJWzqq/UG vnEmHT0cAMJLVqP22Lez8IGZmDrnXzNYstXI7528= Subject: FAILED: patch "[PATCH] x86/boot: Sanitize boot params before parsing command line" failed to apply to 6.1-stable tree To: ardb@kernel.org,hpa@zytor.com,mingo@kernel.org,stable@vger.kernel.org,torvalds@linux-foundation.org Cc: From: Date: Sun, 09 Mar 2025 11:33:06 +0100 Message-ID: <2025030905-canteen-spilt-99c5@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x c00b413a96261faef4ce22329153c6abd4acef25 # git commit -s git send-email --to '' --in-reply-to '2025030905-canteen-spilt-99c5@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From c00b413a96261faef4ce22329153c6abd4acef25 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Thu, 6 Mar 2025 16:59:16 +0100 Subject: [PATCH] x86/boot: Sanitize boot params before parsing command line The 5-level paging code parses the command line to look for the 'no5lvl' string, and does so very early, before sanitize_boot_params() has been called and has been given the opportunity to wipe bogus data from the fields in boot_params that are not covered by struct setup_header, and are therefore supposed to be initialized to zero by the bootloader. This triggers an early boot crash when using syslinux-efi to boot a recent kernel built with CONFIG_X86_5LEVEL=y and CONFIG_EFI_STUB=n, as the 0xff padding that now fills the unused PE/COFF header is copied into boot_params by the bootloader, and interpreted as the top half of the command line pointer. Fix this by sanitizing the boot_params before use. Note that there is no harm in calling this more than once; subsequent invocations are able to spot that the boot_params have already been cleaned up. Signed-off-by: Ard Biesheuvel Signed-off-by: Ingo Molnar Cc: "H. Peter Anvin" Cc: Linus Torvalds Cc: # v6.1+ Link: https://lore.kernel.org/r/20250306155915.342465-2-ardb+git@google.com Closes: https://lore.kernel.org/all/202503041549.35913.ulrich.gemkow@ikr.uni-stuttgart.de diff --git a/arch/x86/boot/compressed/pgtable_64.c b/arch/x86/boot/compressed/pgtable_64.c index c882e1f67af0..d8c5de40669d 100644 --- a/arch/x86/boot/compressed/pgtable_64.c +++ b/arch/x86/boot/compressed/pgtable_64.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include "misc.h" #include +#include #include #include #include "pgtable.h" @@ -107,6 +108,7 @@ asmlinkage void configure_5level_paging(struct boot_params *bp, void *pgtable) bool l5_required = false; /* Initialize boot_params. Required for cmdline_find_option_bool(). */ + sanitize_boot_params(bp); boot_params_ptr = bp; /*