Re: [PATCH] efi: stub out __grub_efi_api when GRUB_UTIL is defined

2024-12-01 Thread Ard Biesheuvel via Grub-devel
On Sat, 30 Nov 2024 at 22:46, Mike Gilbert wrote: > > ms_abi is not a valid attribute on x32 (__x86_64__ && __ILP32__). > This ABI should be unnecessary for utils anyway. > These utils are host tools, right? E.g., grub-install, update-grub, etc running under the OS? Why are those using headers t

Re: [REGRESSION] Re: [PATCH v4 5/5] efi: Use generic EFI loader for x86_64 and i386

2024-07-03 Thread Ard Biesheuvel
On Wed, 3 Jul 2024 at 16:25, Jan Čermák wrote: > > Hi Ard > > On 28. 06. 24 19:28, Ard Biesheuvel wrote: > > Given that you carry your own GRUB build, I would recommend reverting > > to non-EFI stub boot for affected Atom systems, identified by DMI > > data, which sh

Re: [REGRESSION] Re: [PATCH v4 5/5] efi: Use generic EFI loader for x86_64 and i386

2024-06-28 Thread Ard Biesheuvel
On Thu, 27 Jun 2024 at 12:27, Jan Čermák wrote: > > Hi Ard, > > sorry, I feel a little ashamed for replying after such a long time but I > wanted to do some due diligence first and didn't have time (or the Atom > board around) until now. > > > Does your Kconfig have EFI_DISABLE_PCI_DMA enabled by

Re: [REGRESSION] Re: [PATCH v4 5/5] efi: Use generic EFI loader for x86_64 and i386

2024-05-16 Thread Ard Biesheuvel
On Thu, 16 May 2024 at 14:24, Jan Čermák wrote: > > Hi Ard, everyone, > > On 23. 05. 23 17:31, Ard Biesheuvel wrote: > > Switch the x86 based EFI platform builds to the generic EFI loader, > > ... > > We use GRUB as the loader for the Home Assistant Operating Syste

Re: [PATCH v5] efi: Fix stack protector issues

2024-04-29 Thread Ard Biesheuvel
On Sat, 27 Apr 2024 at 15:08, Glenn Washburn wrote: > > From: Ard Biesheuvel > > The 'ground truth' stack protector cookie value is kept in a global > variable, and loaded in every function prologue and epilogue to store > it into resp. compare it with the stack slo

[PATCH v2] efi: Fix stack protector issues

2024-01-12 Thread Ard Biesheuvel via Grub-devel
From: Ard Biesheuvel The 'ground truth' stack protector cookie value is kept in a global variable, and loaded in every function prologue and epilogue to store it into resp. compare it with the stack slot holding the cookie. If the comparison fails, the program aborts, and this m

Re: [PATCH] efi: Fix stack protector issues

2024-01-03 Thread Ard Biesheuvel
On Mon, 1 Jan 2024 at 03:52, Glenn Washburn wrote: > > On Sun, 31 Dec 2023 11:56:18 +0100 > Ard Biesheuvel wrote: > > > Hi Glenn, > > > > On Thu, 28 Dec 2023 at 03:26, Glenn Washburn > > wrote: > > > > > > On Sat, 23 Dec 2023 12:

Re: [PATCH] efi: Fix stack protector issues

2023-12-31 Thread Ard Biesheuvel
Hi Glenn, On Thu, 28 Dec 2023 at 03:26, Glenn Washburn wrote: > > On Sat, 23 Dec 2023 12:45:35 +0100 > Ard Biesheuvel via Grub-devel wrote: > > > From: Ard Biesheuvel > > > > The 'ground truth' stack protector cookie value is kept in a global > > v

[PATCH] efi: Fix stack protector issues

2023-12-23 Thread Ard Biesheuvel via Grub-devel
From: Ard Biesheuvel The 'ground truth' stack protector cookie value is kept in a global variable, and loaded in every function prologue and epilogue to store it into resp. compare it with the stack slot holding the cookie. If the comparison fails, the program aborts, and this m

Re: [PATCH] loader/i386/linux: Prefer entry in long mode when booting via EFI

2023-09-17 Thread Ard Biesheuvel
On Thu, 3 Aug 2023 at 15:24, Ard Biesheuvel wrote: > > The x86_64 Linux kernel can be booted in 32-bit mode, in which case the > startup code creates a set of preliminary page tables that map the first > 1GiB of physical memory 1:1, and enables paging. This is a prerequisite this

Re: [PATCH] loader/i386/linux: Prefer entry in long mode when booting via EFI

2023-09-14 Thread Ard Biesheuvel
ably needed to support other users of Linux protocol > > If somebody needs that thing they can add it later. > > For now Reviewed-by: Daniel Kiper ... > > Though... > > > Le lun. 21 août 2023, 20:12, Ard Biesheuvel a écrit : > > On Thu, 3 Aug 2023 at 15:24, A

Re: [PATCH v9 02/11] Unify GUID types

2023-09-13 Thread Ard Biesheuvel
On Wed, 13 Sept 2023 at 13:42, Vladimir 'phcoder' Serbinenko wrote: > > > > Le mer. 13 sept. 2023, 12:33, Ard Biesheuvel a écrit : >> >> On Wed, 13 Sept 2023 at 12:18, John Paul Adrian Glaubitz >> wrote: >> > >> > Hi Oliver! >>

Re: [PATCH v9 02/11] Unify GUID types

2023-09-13 Thread Ard Biesheuvel
On Wed, 13 Sept 2023 at 12:18, John Paul Adrian Glaubitz wrote: > > Hi Oliver! > > On Wed, 2023-09-13 at 12:14 +0200, Oliver Steffen wrote: > > On Wed, Sep 13, 2023 at 6:10 AM Pedro Miguel Justo wrote: > > > > > > > > > I can confirm that, taking [1][2] and making [3] on top of it, my > > > Mont

Re: [PATCH] loader/i386/linux: Prefer entry in long mode when booting via EFI

2023-09-06 Thread Ard Biesheuvel
On Mon, 21 Aug 2023 at 20:10, Ard Biesheuvel wrote: > > On Thu, 3 Aug 2023 at 15:24, Ard Biesheuvel wrote: > > > > The x86_64 Linux kernel can be booted in 32-bit mode, in which case the > > startup code creates a set of preliminary page tables that map the first > &g

Re: [PATCH v9 02/11] Unify GUID types

2023-08-31 Thread Ard Biesheuvel
On Wed, 30 Aug 2023 at 21:07, Vladimir 'phcoder' Serbinenko wrote: > > > > Le mer. 30 août 2023, 16:38, Daniel Kiper a écrit : >> >> On Wed, Aug 30, 2023 at 04:23:36PM +0200, Ard Biesheuvel wrote: >> > On Wed, 30 Aug 2023 at 16:18, Daniel Kiper wrote:

Re: [PATCH v9 02/11] Unify GUID types

2023-08-30 Thread Ard Biesheuvel
On Wed, 30 Aug 2023 at 16:18, Daniel Kiper wrote: > > On Fri, Aug 25, 2023 at 05:50:58AM -0700, Oliver Steffen wrote: > > Quoting Vladimir 'phcoder' Serbinenko (2023-08-15 18:14:11) > > [...] > > > I am not sure what the best way forward is now, but we at least have the > > patches from Vladimir (

Re: [PATCH] loader/i386/linux: Prefer entry in long mode when booting via EFI

2023-08-21 Thread Ard Biesheuvel
On Thu, 3 Aug 2023 at 15:24, Ard Biesheuvel wrote: > > The x86_64 Linux kernel can be booted in 32-bit mode, in which case the > startup code creates a set of preliminary page tables that map the first > 1GiB of physical memory 1:1, and enables paging. This is a prerequisite

Re: [PATCH v9 02/11] Unify GUID types

2023-08-15 Thread Ard Biesheuvel
On Tue, 15 Aug 2023 at 05:42, Vladimir 'phcoder' Serbinenko wrote: >> >> . >> >> Ard thinks that a 64 bit alignment for EFI GUIDs is a mistake - see [1] >> and [2]. Hence Linux uses `__aligned(__alignof__(u32))` for "efi_guid_t" >> since 2019. > > > My patch presents a reliability paradigm: accept

Re: [PATCH] loader/efi/linux: Implement x86 mixed mode using legacy boot

2023-08-08 Thread Ard Biesheuvel
On Tue, 8 Aug 2023 at 17:34, Dimitri John Ledkov wrote: > > On Mon, 7 Aug 2023, 13:23 Ard Biesheuvel, wrote: > > > > Recent mixed-mode Linux kernels (i.e., v4.0 or newer) can access EFI > > runtime services at OS runtime even when the OS was not entered via the >

[PATCH] loader/efi/linux: Implement x86 mixed mode using legacy boot

2023-08-07 Thread Ard Biesheuvel
builds and get full access to the EFI runtime services. Cc: Daniel Kiper Cc: Steve McIntyre Cc: Julian Andres Klode Signed-off-by: Ard Biesheuvel --- grub-core/loader/efi/linux.c | 5 + include/grub/efi/pe32.h | 6 ++ 2 files changed, 11 insertions(+) diff --git a/grub-core/loade

[PATCH] loader/i386/linux: Prefer entry in long mode when booting via EFI

2023-08-03 Thread Ard Biesheuvel
simplified-architecture.html Cc: Daniel Kiper Cc: Julian Andres Klode Signed-off-by: Ard Biesheuvel --- grub-core/loader/i386/linux.c | 12 include/grub/i386/linux.h | 15 +-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/grub-core/loader/i386/linux.c b/grub-c

Re: [RFC PATCH] efi: Add build error for new EFI arches that do not specify INITRD_MAX_ADDRESS_OFFSET

2023-07-11 Thread Ard Biesheuvel
On Mon, 10 Jul 2023 at 20:33, Glenn Washburn wrote: > > Non-x86 EFI architectures were using a INITRD_MAX_ADDRESS_OFFSET defined > by the aarch64 architecture. This seems to generally work, as in no one > has complained about this. However, the code is misleading. Architectures > should explicitly

Re: [PATCH v3 0/2] efi: Secure Boot fixes

2023-07-03 Thread Ard Biesheuvel
lease review and test. > > Daniel > > Daniel Kiper (2): > efi: Drop __grub_efi_api attribute from shim_lock->verify() function > efi: Fallback to legacy mode if shim is loaded on x86 archs > For the series, Reviewed-by: Ard Biesheuvel > grub-core/kern/e

Re: [PATCH v2 1/2] efi: Drop __grub_efi_api attribute from shim_lock->verify() call

2023-06-30 Thread Ard Biesheuvel
vention annotation to all prototypes) > > > > Signed-off-by: Daniel Kiper > > Acked-by: Ard Biesheuvel > > --- > > include/grub/efi/api.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/include/grub/efi/api.h b/include/g

Re: [PATCH 2/2] efi: Fallback to legacy mode if shim is loaded on x86 archs

2023-06-28 Thread Ard Biesheuvel
On Wed, 28 Jun 2023 at 15:29, Daniel Kiper wrote: > > The LoadImage() provided by the shim does not consult MOK when loading > an image. So, simply signature verification fails when it should not. > This means we cannot use Linux EFI stub to start the kernel when the > shim is loaded. We have to f

Re: [PATCH 1/2] efi: Drop __grub_efi_api attribute from shim_lock->verify() call

2023-06-28 Thread Ard Biesheuvel
On Wed, 28 Jun 2023 at 15:29, Daniel Kiper wrote: > > ... because (surprisingly) it uses System V AMD64 ABI on x86-64 > architecture... > > Fixes: 6a080b9cd (efi: Add calling convention annotation to all prototypes) > > Signed-off-by: Daniel Kiper Acked-by: Ard Biesheuv

Re: [PATCH] efi: Print EFI status as hex number instead of uint

2023-06-27 Thread Ard Biesheuvel
On Tue, 27 Jun 2023 at 21:19, Glenn Washburn wrote: > > EFI status codes are of different classes depending on the first byte and > all error status codes defined in appendix D of the main spec start from 1 > and have the high bit set. When printing as a uint, the decimal is a very > large number

Re: Bad shim signature on kernel loading with patchset from 25.05.2023 and up

2023-06-26 Thread Ard Biesheuvel
On Mon, 26 Jun 2023 at 16:14, Daniel Kiper wrote: > > On Mon, Jun 26, 2023 at 03:58:15PM +0200, Ard Biesheuvel wrote: > > On Mon, 26 Jun 2023 at 15:56, Daniel Kiper wrote: > > > > > > On Mon, Jun 26, 2023 at 03:14:18PM +0200, Tobias Powalowski via > > &g

Re: Bad shim signature on kernel loading with patchset from 25.05.2023 and up

2023-06-26 Thread Ard Biesheuvel
On Mon, 26 Jun 2023 at 15:56, Daniel Kiper wrote: > > On Mon, Jun 26, 2023 at 03:14:18PM +0200, Tobias Powalowski via Grub-devel > wrote: > > Am Mo., 26. Juni 2023 um 14:28 Uhr schrieb Daniel Kiper > > : > > Hey, > > > > Thomas, good point. I completely missed that. > > > > Tobias

Re: Bad shim signature on kernel loading with patchset from 25.05.2023 and up

2023-06-23 Thread Ard Biesheuvel
On Fri, 23 Jun 2023 at 16:18, Tobias Powalowski wrote: > > Am Fr., 23. Juni 2023 um 16:02 Uhr schrieb Daniel Kiper : >> >> On Thu, Jun 22, 2023 at 11:40:47AM +0200, Tobias Powalowski via Grub-devel >> wrote: >> > Hi tackled it down to this commit: >> > https://git.savannah.gnu.org/cgit/grub.git/c

Re: Bad shim signature on kernel loading with patchset from 25.05.2023 and up

2023-06-23 Thread Ard Biesheuvel
On Fri, 23 Jun 2023 at 15:46, Tobias Powalowski wrote: > > > > Am Fr., 23. Juni 2023 um 15:41 Uhr schrieb Ard Biesheuvel : >> >> On Thu, 22 Jun 2023 at 11:41, Tobias Powalowski >> wrote: >> > >> > Hi tackled it down to this commit: >> &

Re: Bad shim signature on kernel loading with patchset from 25.05.2023 and up

2023-06-23 Thread Ard Biesheuvel
On Thu, 22 Jun 2023 at 11:41, Tobias Powalowski wrote: > > Hi tackled it down to this commit: > https://git.savannah.gnu.org/cgit/grub.git/commit/?id=6a080b9cde0be5d08b71daf17a806067e32fc13f > starting with this commit shim verification fails for kernel hash with bad > shim verification and makes

Re: [PATCH v2 0/2] EFI chainloader improvement

2023-06-01 Thread Ard Biesheuvel
n that the device path in question is not installed on a handle, I'm not even sure whether creating that memory mapped device path serves any purpose tbh. So this approach seems perfectly reasonable to me. Reviewed-by: Ard Biesheuvel ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel

[PATCH v2] efi: Handle NULL return value when getting loaded image protocol

2023-05-24 Thread Ard Biesheuvel
t the image but unload it and return an error. Signed-off-by: Ard Biesheuvel --- grub-core/loader/efi/linux.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c index 90ad1a7b82a76066..8211f7892ad391f1 100644 --- a

Re: [PATCH] efi: Handle NULL return value when getting loaded image protocol

2023-05-24 Thread Ard Biesheuvel
On Wed, 24 May 2023 at 19:15, Ard Biesheuvel wrote: > > The EFI spec mandates that the handle produced by the LoadImage boot > service has a LoadedImage protocol instance installed on it, but for > robustness, we should still deal with a NULL return value from the > helper routi

[PATCH] efi: Handle NULL return value when getting loaded image protocol

2023-05-24 Thread Ard Biesheuvel
t the image but unload it and return an error. Signed-off-by: Ard Biesheuvel --- grub-core/loader/efi/linux.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c index 90ad1a7b82a76066..b434c56ae67d665e 100644 --- a/grub-core/loade

Re: [PATCH v4 5/5] efi: Use generic EFI loader for x86_64 and i386

2023-05-23 Thread Ard Biesheuvel
On Tue, 23 May 2023 at 17:32, Ard Biesheuvel wrote: > > Switch the x86 based EFI platform builds to the generic EFI loader, > which exposes the initrd via the LoadFile2 protocol instead of the > x86-specific setup header. This will launch the Linux kernel via its EFI > stub, whi

[PATCH v4 2/5] efi: Add calling convention annotation to all prototypes

2023-05-23 Thread Ard Biesheuvel
generate the correct instruction sequence for us. So let's add the appropriate annotation to all the function prototypes. This will allow us to drop the special call wrappers in a subsequent patch. Signed-off-by: Ard Biesheuvel --- grub-core/efiemu/runtime/efiemu.c | 48 +- grub-core/kern/ar

[PATCH v4 4/5] efi: Remove x86_64 call wrappers

2023-05-23 Thread Ard Biesheuvel
The call wrappers are no longer needed now that GCC can generate function calls using MS calling convention, so let's get rid of them. Signed-off-by: Ard Biesheuvel --- grub-core/Makefile.core.def | 1 - grub-core/kern/x86_64/efi/callwrap.S | 129 include

[PATCH v4 3/5] efi: Drop all uses of efi_call_XX wrappers

2023-05-23 Thread Ard Biesheuvel
. Signed-off-by: Ard Biesheuvel --- grub-core/commands/acpi.c | 8 +-- grub-core/commands/efi/efitextmode.c | 8 ++- grub-core/commands/efi/lsefi.c| 5 +- grub-core/commands/efi/tpm.c | 21 grub-core/disk/efi/efidisk.c | 7 +-- grub-core/kern/arm/efi

[PATCH v4 1/5] efi: Make EFI PXE protocol methods non-callable

2023-05-23 Thread Ard Biesheuvel
alled inadvertently. Signed-off-by: Ard Biesheuvel --- include/grub/efi/api.h | 24 ++-- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h index 4ae5e51c9013ceb3..7077d2265df9b20a 100644 --- a/include/grub/efi/api.h

[PATCH v4 0/5] efi: Implement generic EFI boot for x86

2023-05-23 Thread Ard Biesheuvel
kernels that lack EFI stub or LoadFile2 support. This removes the need for additional changes to support v5.8 or older kernels. Cc: Daniel Kiper Cc: Glenn Washburn Ard Biesheuvel (5): efi: Make EFI PXE protocol methods non-callable efi: Add calling convention annotation to all prototypes

[PATCH v4 5/5] efi: Use generic EFI loader for x86_64 and i386

2023-05-23 Thread Ard Biesheuvel
EFI handover protocol, which has no basis in the UEFI specification, is not implemented. Signed-off-by: Ard Biesheuvel --- grub-core/Makefile.core.def | 2 + grub-core/loader/efi/linux.c | 47 ++-- grub-core/loader/i386/linux.c | 8 include/grub/efi/efi.h| 2 +- 4

[PATCH v3 1/5] efi: Make EFI PXE protocol methods non-callable

2023-05-23 Thread Ard Biesheuvel
alled inadvertently. Signed-off-by: Ard Biesheuvel --- include/grub/efi/api.h | 24 ++-- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h index 4ae5e51c9013ceb3..7077d2265df9b20a 100644 --- a/include/grub/efi/api.h

[PATCH v3 5/5] efi: Use generic EFI loader for x86_64 and i386

2023-05-23 Thread Ard Biesheuvel
EFI handover protocol, which has no basis in the UEFI specification, is not implemented. Signed-off-by: Ard Biesheuvel --- grub-core/Makefile.core.def | 2 + grub-core/loader/efi/linux.c | 40 +++- grub-core/loader/i386/linux.c | 8 include/grub/efi/efi.h| 2 +- 4

[PATCH v3 2/5] efi: Add calling convention annotation to all prototypes

2023-05-23 Thread Ard Biesheuvel
generate the correct instruction sequence for us. So let's add the appropriate annotation to all the function prototypes. This will allow us to drop the special call wrappers in a subsequent patch. Signed-off-by: Ard Biesheuvel --- grub-core/kern/arm/efi/init.c | 2 +- include/grub/efi/

[PATCH v3 0/5] efi: Implement generic EFI boot for x86

2023-05-23 Thread Ard Biesheuvel
or not; - enable generic EFI for i386 as well - wire up the existing x86 code as a fallback for kernels that lack EFI stub or LoadFile2 support. This removes the need for additional changes to support v5.8 or older kernels. Cc: Daniel Kiper Cc: Glenn Washburn Ard Biesheuvel (5): efi: Make

[PATCH v3 3/5] efi: Drop all uses of efi_call_XX wrappers

2023-05-23 Thread Ard Biesheuvel
. Signed-off-by: Ard Biesheuvel --- grub-core/commands/acpi.c | 8 +-- grub-core/commands/efi/efitextmode.c | 8 ++- grub-core/commands/efi/lsefi.c| 5 +- grub-core/commands/efi/tpm.c | 21 grub-core/disk/efi/efidisk.c | 7 +-- grub-core/kern/arm/efi

[PATCH v3 4/5] efi: Remove x86_64 call wrappers

2023-05-23 Thread Ard Biesheuvel
The call wrappers are no longer needed now that GCC can generate function calls using MS calling convention, so let's get rid of them. Signed-off-by: Ard Biesheuvel --- grub-core/Makefile.core.def | 1 - grub-core/kern/x86_64/efi/callwrap.S | 129 include

Re: [PATCH v2 6/6] efi: Use generic EFI loader for x86_64 and i386

2023-05-16 Thread Ard Biesheuvel
On Sun, 14 May 2023 at 07:12, Glenn Washburn wrote: > > On Thu, 11 May 2023 14:06:40 +0200 > Ard Biesheuvel wrote: > > > Switch the x86 based EFI platform builds to the generic EFI loader, > > which exposes the initrd via the LoadFile2 protocol instead of the > > x

Re: [PATCH v2 1/6] ia64: Remove support

2023-05-12 Thread Ard Biesheuvel
On Fri, 12 May 2023 at 12:42, John Paul Adrian Glaubitz wrote: > > Hello Ard! > > On Thu, 2023-05-11 at 16:29 +0200, Ard Biesheuvel wrote: > > > > Feel free to keep using it, but please stop demanding that our people > > > > keep wasting their time on it.

Re: [PATCH v2 1/6] ia64: Remove support

2023-05-12 Thread Ard Biesheuvel
On Fri, 12 May 2023 at 00:41, matoro wrote: > > On 2023-05-11 18:09, Ard Biesheuvel wrote: > > On Thu, 11 May 2023 at 20:59, matoro > > wrote: > >> > >> On 2023-05-11 10:29, Ard Biesheuvel wrote: > >> > On Thu, 11 May 2023 at 15:34, John Paul Adria

Re: [PATCH v2 1/6] ia64: Remove support

2023-05-11 Thread Ard Biesheuvel
On Thu, 11 May 2023 at 20:59, matoro wrote: > > On 2023-05-11 10:29, Ard Biesheuvel wrote: > > On Thu, 11 May 2023 at 15:34, John Paul Adrian Glaubitz > > wrote: > >> > >> On Thu, 2023-05-11 at 14:17 +0200, Ard Biesheuvel wrote: > >> > On Thu,

Re: [PATCH v2 1/6] ia64: Remove support

2023-05-11 Thread Ard Biesheuvel
On Thu, 11 May 2023 at 15:34, John Paul Adrian Glaubitz wrote: > > On Thu, 2023-05-11 at 14:17 +0200, Ard Biesheuvel wrote: > > On Thu, 11 May 2023 at 14:14, John Paul Adrian Glaubitz > > wrote: > > > > > > On Thu, 2023-05-11 at 14:06 +0200, Ard Biesheuvel wro

Re: [PATCH v2 1/6] ia64: Remove support

2023-05-11 Thread Ard Biesheuvel
On Thu, 11 May 2023 at 14:14, John Paul Adrian Glaubitz wrote: > > On Thu, 2023-05-11 at 14:06 +0200, Ard Biesheuvel wrote: > > Itanium IA-64 support is obsolete, and implements its own flavor of EFI > > boot that deviates from other architectures. Given that IA64 is unused &g

Re: [PATCH v2 6/6] efi: Use generic EFI loader for x86_64 and i386

2023-05-11 Thread Ard Biesheuvel
On Thu, 11 May 2023 at 14:06, Ard Biesheuvel wrote: > > Switch the x86 based EFI platform builds to the generic EFI loader, > which exposes the initrd via the LoadFile2 protocol instead of the > x86-specific setup header. This will launch the Linux kernel via its EFI > stub, whi

[PATCH v2 5/6] efi: Remove x86_64 call wrappers

2023-05-11 Thread Ard Biesheuvel
The call wrappers are no longer needed now that GCC can generate function calls using MS calling convention, so let's get rid of them. Signed-off-by: Ard Biesheuvel --- grub-core/Makefile.core.def | 1 - grub-core/kern/x86_64/efi/callwrap.S | 129 include

[PATCH v2 2/6] efi: Make EFI PXE protocol methods non-callable

2023-05-11 Thread Ard Biesheuvel
alled inadvertently. Signed-off-by: Ard Biesheuvel --- include/grub/efi/api.h | 24 ++-- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h index b4c4646651cd53f5..da1a80ca3a94fe1c 100644 --- a/include/grub/efi/api.h

[PATCH v2 0/6] efi: Implement generic EFI boot for x86

2023-05-11 Thread Ard Biesheuvel
test whether our changes break the boot for it or not; - enable generic EFI for i386 as well - wire up the existing x86 code as a fallback for kernels that lack EFI stub or LoadFile2 support. This removes the need for additional changes to support v5.8 or older kernels. Ard Biesheuvel (6

[PATCH v2 1/6] ia64: Remove support

2023-05-11 Thread Ard Biesheuvel
d-off-by: Ard Biesheuvel --- .travis.yml | 7 +- Makefile.util.def | 1 - configure.ac | 8 - docs/grub-dev.texi| 2 +- docs/grub.texi| 2 +- gentpl.py | 6 +- grub

[PATCH v2 4/6] efi: Drop all uses of efi_call_XX wrappers

2023-05-11 Thread Ard Biesheuvel
. Signed-off-by: Ard Biesheuvel --- grub-core/commands/acpi.c| 8 +-- grub-core/commands/efi/efitextmode.c | 8 ++- grub-core/commands/efi/lsefi.c | 5 +- grub-core/commands/efi/tpm.c | 21 grub-core/disk/efi/efidisk.c | 7 +-- grub-core/kern/arm/efi/init.c

[PATCH v2 6/6] efi: Use generic EFI loader for x86_64 and i386

2023-05-11 Thread Ard Biesheuvel
EFI handover protocol, which has no basis in the UEFI specification, is not implemented. Signed-off-by: Ard Biesheuvel --- grub-core/Makefile.core.def | 5 +- grub-core/loader/efi/linux.c | 51 ++-- grub-core/loader/i386/linux.c | 8 +++ include/grub/efi/efi.h| 2 +- 4

[PATCH v2 3/6] efi: Add calling convention annotation to all prototypes

2023-05-11 Thread Ard Biesheuvel
generate the correct instruction sequence for us. So let's add the appropriate annotation to all the function prototypes. This will allow us to drop the special call wrappers in a subsequent patch. Signed-off-by: Ard Biesheuvel --- grub-core/kern/arm/efi/init.c | 2 +- include/grub/efi/

Re: [PATCH 5/5] efi: Use generic EFI loader for x86_64

2023-05-11 Thread Ard Biesheuvel
On Wed, 10 May 2023 at 19:40, Ard Biesheuvel wrote: > > On Wed, 10 May 2023 at 15:15, Daniel Kiper wrote: > > > > On Wed, May 10, 2023 at 12:40:30PM +0200, Ard Biesheuvel wrote: > > > On Tue, 9 May 2023 at 18:53, Ard Biesheuvel wrote: > > > > > > &

Re: [PATCH 5/5] efi: Use generic EFI loader for x86_64

2023-05-10 Thread Ard Biesheuvel
On Wed, 10 May 2023 at 15:15, Daniel Kiper wrote: > > On Wed, May 10, 2023 at 12:40:30PM +0200, Ard Biesheuvel wrote: > > On Tue, 9 May 2023 at 18:53, Ard Biesheuvel wrote: > > > > > > Switch the x86_64 build to the generic EFI loader, which exposes the > >

Re: [PATCH 5/5] efi: Use generic EFI loader for x86_64

2023-05-10 Thread Ard Biesheuvel
On Tue, 9 May 2023 at 18:53, Ard Biesheuvel wrote: > > Switch the x86_64 build to the generic EFI loader, which exposes the > initrd via the LoadFile2 protocol instead of the x86-specific setup > header. This will launch the Linux kernel via its EFI stub, which > performs its own

[PATCH 3/5] efi: Drop all uses of efi_call_XX wrappers

2023-05-09 Thread Ard Biesheuvel
. Signed-off-by: Ard Biesheuvel --- grub-core/commands/acpi.c| 8 +-- grub-core/commands/efi/efitextmode.c | 8 ++- grub-core/commands/efi/lsefi.c | 5 +- grub-core/commands/efi/tpm.c | 21 grub-core/disk/efi/efidisk.c | 7 +-- grub-core/kern/arm/efi/init.c

[PATCH 4/5] efi: Remove x86_64 call wrappers

2023-05-09 Thread Ard Biesheuvel
The call wrappers are no longer needed now that GCC can generate function calls using MS calling convention, so let's get rid of them. Signed-off-by: Ard Biesheuvel --- grub-core/Makefile.core.def | 1 - grub-core/kern/x86_64/efi/callwrap.S | 129 include

[PATCH 1/5] efi: Make EFI PXE protocol methods non-callable

2023-05-09 Thread Ard Biesheuvel
alled inadvertently. Signed-off-by: Ard Biesheuvel --- include/grub/efi/api.h | 24 ++-- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h index b4c4646651cd53f5..da1a80ca3a94fe1c 100644 --- a/include/grub/efi/api.h

[PATCH 5/5] efi: Use generic EFI loader for x86_64

2023-05-09 Thread Ard Biesheuvel
ExitBootServices() and performing the bare metal Linux boot. Signed-off-by: Ard Biesheuvel --- grub-core/Makefile.core.def | 6 +- grub-core/kern/efi/mm.c | 2 +- grub-core/loader/efi/linux.c | 12 include/grub/efi/efi.h | 2 ++ 4 files changed, 16 insertions(+), 6 deletions

[PATCH 0/5] efi: Implement generic EFI boot for x86_64

2023-05-09 Thread Ard Biesheuvel
cleanup first, so we no longer need to rely on the MS to SysV calling convention translation code. Ard Biesheuvel (5): efi: Make EFI PXE protocol methods non-callable efi: Add calling convention annotation to all prototypes efi: Drop all uses of efi_call_XX wrappers efi: Remove x86_64 call

[PATCH 2/5] efi: Add calling convention annotation to all prototypes

2023-05-09 Thread Ard Biesheuvel
generate the correct instruction sequence for us. So let's add the appropriate annotation to all the function prototypes. This will allow us to drop the special call wrappers in a subsequent patch. Signed-off-by: Ard Biesheuvel --- grub-core/kern/arm/efi/init.c | 2 +- include/grub/efi/

Re: Handling large allocations (bypassing mm?)

2022-12-22 Thread Ard Biesheuvel
On Fri, 16 Dec 2022 at 18:55, Robbie Harwood wrote: > > Ard Biesheuvel writes: > > > As for supporing kernels from 2012: I don't see why upstream GRUB > > should care about that. If your distro fork supports those today, you > > will simply need to carry those

Re: Handling large allocations (bypassing mm?)

2022-12-15 Thread Ard Biesheuvel
On Thu, 15 Dec 2022 at 15:29, Julian Andres Klode wrote: > > On Wed, Dec 14, 2022 at 04:11:18PM +0100, Daniel Kiper wrote: > > Adding a few folks who may be interested in this discussion too... > > > > On Wed, Dec 14, 2022 at 02:21:49PM +0100, Julian Andres Klode wrote: > > > Hi, > > > > > > so I

Re: [PATCH v2 2/2] efi: Put Linux specific magic number in the DOS header

2022-12-07 Thread Ard Biesheuvel
On Wed, 7 Dec 2022 at 11:36, Xiaotian Wu wrote: > > 在 2022-12-07星期三的 09:06 +0100,Ard Biesheuvel写道: > > On Wed, 7 Dec 2022 at 08:51, Xiaotian Wu > > wrote: > > > > > > 在 2022-11-29星期二的 18:56 +0100,Ard Biesheuvel写道: > > > > GRUB currently r

Re: [PATCH v2 2/2] efi: Put Linux specific magic number in the DOS header

2022-12-07 Thread Ard Biesheuvel
On Wed, 7 Dec 2022 at 08:51, Xiaotian Wu wrote: > > 在 2022-11-29星期二的 18:56 +0100,Ard Biesheuvel写道: > > GRUB currently relies on the magic number in the image header of ARM > > and > > arm64 EFI kernel images to decide whether or not the image in > > que

Re: [PATCH v2 2/2] efi: Put Linux specific magic number in the DOS header

2022-12-01 Thread Ard Biesheuvel
On Thu, 1 Dec 2022 at 15:30, Daniel Kiper wrote: > > On Tue, Nov 29, 2022 at 06:56:16PM +0100, Ard Biesheuvel wrote: > > GRUB currently relies on the magic number in the image header of ARM and > > arm64 EFI kernel images to decide whether or not the image in question > &

[PATCH v2 2/2] efi: Put Linux specific magic number in the DOS header

2022-11-29 Thread Ard Biesheuvel
t here. Cc: Huacai Chen Cc: Atish Patra Cc: Heinrich Schuchardt Cc: Daniel Kiper Cc: Leif Lindholm Signed-off-by: Ard Biesheuvel --- arch/loongarch/kernel/head.S| 3 ++- arch/x86/boot/header.S | 3 ++- drivers/firmware/efi/libstub/zboot-header.S | 3 ++- in

[PATCH v2 0/2] efi: Add generic magic number in header

2022-11-29 Thread Ard Biesheuvel
sting images already exist, so for those architectures, we have to consider both anyway. Cc: Huacai Chen Cc: Atish Patra Cc: Heinrich Schuchardt Cc: Daniel Kiper Cc: Leif Lindholm Ard Biesheuvel (2): efi: libstub: Always enable initrd command line loader and bump version efi: Put

[PATCH v2 1/2] efi: libstub: Always enable initrd command line loader and bump version

2022-11-29 Thread Ard Biesheuvel
In preparation for setting a cross-architecture baseline for EFI boot support, remove the Kconfig option that permits the command line initrd loader to be disabled. Also, bump the minor version so that any image built with the new version can be identified as supporting this. Signed-off-by: Ard

Re: [RFC PATCH] efi: Put Linux specific magic number in the DOS header

2022-11-10 Thread Ard Biesheuvel
On Thu, 10 Nov 2022 at 00:27, Daniel Kiper wrote: > > On Wed, Nov 09, 2022 at 04:01:27PM +0100, Heinrich Schuchardt wrote: > > On 11/9/22 15:16, Ard Biesheuvel wrote: > > > GRUB currently relies on the magic number in the image header of ARM and > > > arm64 EFI kern

[RFC PATCH] efi: Put Linux specific magic number in the DOS header

2022-11-09 Thread Ard Biesheuvel
bit ARM already uses the same location in the header for a different purpose, but the ARM support is already widely implemented and the EFI zboot decompressor is not available on ARM anyway, so we just disregard it here. Cc: Huacai Chen Cc: Atish Patra Cc: Heinrich Schuchardt Cc: Daniel

Re: [v6 PATCH 2/3] RISC-V: Update image header

2022-11-09 Thread Ard Biesheuvel
On Wed, 9 Nov 2022 at 13:50, Ard Biesheuvel wrote: > > On Wed, 9 Nov 2022 at 13:38, Leif Lindholm wrote: > > > > On Wed, Nov 09, 2022 at 13:10:29 +0100, Ard Biesheuvel wrote: > > > > > > The drawback to that is that not all EFI executables are destined &

Re: [v6 PATCH 2/3] RISC-V: Update image header

2022-11-09 Thread Ard Biesheuvel
On Wed, 9 Nov 2022 at 13:38, Leif Lindholm wrote: > > On Wed, Nov 09, 2022 at 13:10:29 +0100, Ard Biesheuvel wrote: > > > > > The drawback to that is that not all EFI executables are destined for > > > > > the Linux loader. So while trying to boot them

Re: [v6 PATCH 2/3] RISC-V: Update image header

2022-11-09 Thread Ard Biesheuvel
On Wed, 9 Nov 2022 at 13:01, Leif Lindholm wrote: > > On Wed, Nov 09, 2022 at 12:33:58 +0100, Ard Biesheuvel wrote: > > > > Can we get rid of these header definitions entirely? > > > > > > > > The only GRUB code that seems to care about the fields that a

Re: [v6 PATCH 2/3] RISC-V: Update image header

2022-11-09 Thread Ard Biesheuvel
On Wed, 9 Nov 2022 at 12:21, Leif Lindholm wrote: > > On Tue, Nov 08, 2022 at 17:36:51 +0100, Ard Biesheuvel wrote: > > > I can agree that hdr_offset makes more sense but > > > Documentation/riscv/boot-image-header.rst names this member as res3. > > > So, I would

Re: [v6 PATCH 2/3] RISC-V: Update image header

2022-11-09 Thread Ard Biesheuvel
On Wed, 9 Nov 2022 at 09:13, Atish Kumar Patra wrote: > > > > On Tue, Nov 8, 2022 at 8:37 AM Ard Biesheuvel wrote: >> >> On Tue, 8 Nov 2022 at 16:59, Daniel Kiper wrote: >> > >> > On Fri, Nov 04, 2022 at 04:26:06PM -0700, Atish Patra wrote: >> >

Re: [v6 PATCH 2/3] RISC-V: Update image header

2022-11-08 Thread Ard Biesheuvel
On Tue, 8 Nov 2022 at 16:59, Daniel Kiper wrote: > > On Fri, Nov 04, 2022 at 04:26:06PM -0700, Atish Patra wrote: > > Update the RISC-V Linux kernel image headers as per the current header. > > > > Reference: > > /Documentation/riscv/boot-image-header.rst > > > > 474efecb65dc: ("riscv: modify the

Re: [PATCH v5 0/6] linux: implement LoadFile2 initrd loading

2022-10-21 Thread Ard Biesheuvel
On Fri, 21 Oct 2022 at 14:51, Daniel Kiper wrote: > > On Tue, Oct 18, 2022 at 09:05:01PM +0200, Ard Biesheuvel wrote: > > This implements the LoadFile2 initrd loading protocol, which is > > essentially a callback interface into the bootloader to load the initrd > > dat

[PATCH v5 5/6] efi: implement LoadFile2 initrd loading protocol for Linux

2022-10-18 Thread Ard Biesheuvel
F image version), and defer loading the initrd contents until the point where the kernel invokes the LoadFile2 protocol. Signed-off-by: Ard Biesheuvel Reviewed-by: Heinrich Schuchardt Tested-by: Ilias Apalodimas Reviewed-by: Ilias Apalodimas --- grub-core/commands/efi/lsefi.c | 1 + grub-co

[PATCH v5 1/6] efi: move MS-DOS stub out of generic PE header definition

2022-10-18 Thread Ard Biesheuvel
ved into a struct grub_pe_image_header, which we will use later to access COFF header fields of arbitrary images (and which may therefore appear at different offsets) Signed-off-by: Ard Biesheuvel --- grub-core/kern/efi/efi.c | 8 ++-- include/grub/efi/pe32.h | 16 2 files c

[PATCH v5 4/6] efi/efinet: Don't close connections at fini_hw() time

2022-10-18 Thread Ard Biesheuvel
cates to the network core that EFI network devices should not be closed when grub_net_fini_hw() is called. Signed-off-by: Ard Biesheuvel Reviewed-by: Heinrich Schuchardt Reviewed-by: Daniel Kiper --- grub-core/net/drivers/efi/efinet.c | 10 +- grub-core/net/net.c

[PATCH v5 6/6] linux: ignore FDT unless we need to modify it

2022-10-18 Thread Ard Biesheuvel
ignore it entirely. The only remaining reason to deal with the devicetree is if we are using the 'devicetree' command to load one from disk, so tweak the logic in grub_fdt_install() to take that into account. Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm Reviewed-by: Da

[PATCH v5 2/6] linux/arm: unify ARM/arm64 vs Xen PE/COFF header handling

2022-10-18 Thread Ard Biesheuvel
grub_arch_efi_linux_check_image() is preceded by a load of the image header, let's move the load into that function, and rename it to grub_arch_efi_linux_load_image_header()/ Signed-off-by: Ard Biesheuvel --- grub-core/loader/arm64/linux.c| 12 +- grub-core/loader/arm64/xen_boot.c

[PATCH v5 3/6] linux/arm: account for COFF headers appearing at unexpected offsets

2022-10-18 Thread Ard Biesheuvel
anywhere in the file, let's ensure that we read the header from where it actually appears in the file if it is not located at offset 0x40. Signed-off-by: Ard Biesheuvel --- grub-core/loader/arm64/linux.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/grub-core/loader/

[PATCH v5 0/6] linux: implement LoadFile2 initrd loading

2022-10-18 Thread Ard Biesheuvel
e Cc: Ilias Apalodimas Ard Biesheuvel (6): efi: move MS-DOS stub out of generic PE header definition linux/arm: unify ARM/arm64 vs Xen PE/COFF header handling linux/arm: account for COFF headers appearing at unexpected offsets efi/efinet: Don't close connections at fini_hw() time

Re: [v5 PATCH 0/3] Unify ARM64 & RISC-V Linux Loader

2022-10-10 Thread Ard Biesheuvel
On Mon, 10 Oct 2022 at 16:58, Daniel Kiper wrote: > > On Fri, Oct 07, 2022 at 01:50:27AM -0700, Atish Patra wrote: > > This series unifies the linux loader for ARM64 & RISC-V. The linux loader > > for ARM64 is pretty much arch independent. Thus, this series just moves > > it to the common director

Re: [PATCH v4 1/6] efi: move MS-DOS stub out of generic PE header definition

2022-09-15 Thread Ard Biesheuvel
On Thu, 15 Sept 2022 at 14:21, Leif Lindholm wrote: > > On Thu, Sep 08, 2022 at 15:30:12 +0200, Ard Biesheuvel wrote: > > The PE/COFF spec permits the COFF signature and file header to appear > > anywhere in the file, and the actual offset is recorded in 4 byte > > littl

[PATCH v4 2/6] linux/arm: unify ARM/arm64 vs Xen PE/COFF header handling

2022-09-08 Thread Ard Biesheuvel
Xen has its own version of the image header, to account for the additional PE/COFF header fields. Since we are adding references to those in the shared EFI loader code, update the common definitions and drop the Xen specific one which no longer has a purpose. Signed-off-by: Ard Biesheuvel

[PATCH v4 5/6] efi: implement LoadFile2 initrd loading protocol for Linux

2022-09-08 Thread Ard Biesheuvel
F image version), and defer loading the initrd contents until the point where the kernel invokes the LoadFile2 protocol. Signed-off-by: Ard Biesheuvel Reviewed-by: Heinrich Schuchardt Tested-by: Ilias Apalodimas Reviewed-by: Ilias Apalodimas --- grub-core/commands/efi/lsefi.c | 1 + grub-co

  1   2   >