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 D844047A6B for ; Sat, 6 Dec 2025 11:45:34 +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=1765021534; cv=none; b=UGl06MJ9diVyF2zlP86hb33cC/aq8ey0Eczt5sxyjuUkTswwmgnWSpkqTfi4lGwTJmNnTArITCQWysqy3dcvcVEJ1+W66BiuD0chrXu44yjC/PT5B0JZ+Ox3r/OPukfzrsgA1HHLc57jMHQRVrFekrdFurx3D2QszEiebT70tOo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765021534; c=relaxed/simple; bh=h/Vgmev2bM4sFczMEVO9vRHdC4rOJXaNfjuqWz4wSlA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MQ1ubV49A9lvx1UWwYTBFvdVoOCd3IZk/YF8Dfbeut9PJlUt4PcJPbnph2jCSL7FPo0mgZh3XPzwK4aU7fKfLUx7im/Iuyo2wMaBnXKuGlQWZnRGFd/dxAHLoUxp+w4Y5uD8W0T++2DBAzBWPr/Hiz7+jyJgxHFamUCpbenBybI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rOKLOwNo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rOKLOwNo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23362C4CEF5; Sat, 6 Dec 2025 11:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765021534; bh=h/Vgmev2bM4sFczMEVO9vRHdC4rOJXaNfjuqWz4wSlA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rOKLOwNoa/5huJgdwaZYrz2rlTxAfAqHOK/h6Irh4sJZW8TLtzVxIgmbHIK2kqPGD y5evzUbgqDNSkmZdwlp1XrZBQP9MHrIRp0cog1nEbKXt/BpaLYNUUaAkRWUwvLF0MA xCZsSzpvSw+1BiQ9L11vDFMR/Z6aaPVT8qQeaJULLPIeVXnHkqjA9/Mg9KkfCsUppm Rl/DQdTCtbNE9BvOVqhnhckzBX+Czpk4z1H2+NnU0pibTyGFzK5SW8bbgKfWvDZBqA UUcbXb84my852OivQKiZw3zuDChwO16bLMyWQe6GirRpY/HnBrSpx4pNTM6RTlK4bb bMJkTA5Rz0qdw== Date: Sat, 6 Dec 2025 12:45:29 +0100 From: Ingo Molnar To: "H. Peter Anvin" Cc: James Le Cuirot , x86@kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Ard Biesheuvel Subject: Re: [PATCH] x86: fix oops caused by old EFI info on kexec boot Message-ID: References: <20251126173209.374755-2-chewi@gentoo.org> <76520AF9-9A09-4D9C-850F-04761E1C1484@zytor.com> <05db807e-887a-4502-8de1-ec9910f66b60@zytor.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=us-ascii Content-Disposition: inline In-Reply-To: <05db807e-887a-4502-8de1-ec9910f66b60@zytor.com> * H. Peter Anvin wrote: > --- a/arch/x86/include/uapi/asm/bootparam.h > +++ b/arch/x86/include/uapi/asm/bootparam.h > @@ -26,6 +26,28 @@ > #define XLF_5LEVEL_ENABLED (1<<6) > #define XLF_MEM_ENCRYPTION (1<<7) > > +/* bootloader ID */ > +#define BOOTLOADER_LILO 0x00 > +#define BOOTLOADER_LOADLIN 0x01 > +/* 0x02 used by kernel internal boot sector - long since obsolete */ > +#define BOOTLOADER_SYSLINUX 0x03 > +#define BOOTLOADER_IPXE 0x04 > +#define BOOTLOADER_ELILO 0x05 > +/* 0x06 unknown user */ > +#define BOOTLOADER_GRUB 0x07 > +#define BOOTLOADER_UBOOT 0x08 > +#define BOOTLOADER_XEN 0x09 > +#define BOOTLOADER_GUJIN 0x0a > +#define BOOTLOADER_QEMU 0x0b > +#define BOOTLOADER_ARCTURUS 0x0c /* "Arcturus Networks uCbootloader" */ > +#define BOOTLOADER_KEXEC_TOOLS 0x0d > +#define BOOTLOADER_EXTENDED_ID 0x0e /* Escape into the 0x10+ space */ > +#define BOOTLOADER_MISSING_ID 0x0f /* Bootloader unknown */ > +#define BOOTLOADER_EXTID_BASE 0x10 /* Error: ext_loader_type never set */ > +#define BOOTLOADER_MINIMAL 0x11 /* "Minimal Linux Bootloader" */ > +#define BOOTLOADER_OVMF 0x12 > +#define BOOTLOADER_BAREBOX 0x13 > + > #ifndef __ASSEMBLER__ > > #include > @@ -162,6 +184,28 @@ struct boot_params { > __u8 _pad9[276]; /* 0xeec */ > } __attribute__((packed)); > > +static inline unsigned int boot_loader_type(const struct boot_params *_bp) > +{ > + unsigned int _type = _bp->type_of_loader >> 4; > + if (_type == BOOTLOADER_EXTENDED_ID) > + _type = _bp->ext_loader_type + BOOTLOADER_EXTID_BASE > + return _type; > +} > +static inline unsigned int boot_loader_ver(const struct boot_params *_bp) > +{ > + return (_bp->type_of_loader & 0x0f) + (_bp->ext_loader_ver << 4); > +} > +static inline void set_boot_loader(struct boot_params *_bp, > + unsigned int _type, unsigned int _ver) > +{ > + if (_type >= BOOTLOADER_EXTID_BASE) { > + _bp->ext_loader_type = _type - BOOTLOADER_EXTID_BASE; > + _type = BOOTLOADER_EXTENDED_ID; > + } > + _bp->ext_loader_ver = _ver >> 4; > + _bp->type_of_loader = _type + (_ver & 0x0f); > +} Ack, with a s/_bp/bp, s/_type/type and s/_ver/ver side note, as this isn't a macro and thus there's no need to obfuscate the inline function's parameter name to avoid unintended shadowing? Thanks, Ingo