* [PATCH 1/2] x86/efistub: Avoid returning EFI_SUCCESS on error
@ 2024-07-04 12:46 Ard Biesheuvel
2024-07-04 12:46 ` [PATCH 2/2] x86/efistub: Drop redundant clearing of BSS Ard Biesheuvel
0 siblings, 1 reply; 2+ messages in thread
From: Ard Biesheuvel @ 2024-07-04 12:46 UTC (permalink / raw)
To: linux-efi; +Cc: Ard Biesheuvel
From: Ard Biesheuvel <ardb@kernel.org>
The fail label is only used in a situation where the previous EFI API
call succeeded, and so status will be set to EFI_SUCCESS. Fix this, by
dropping the goto entirely, and call efi_exit() with the correct error
code.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
drivers/firmware/efi/libstub/x86-stub.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
index 51b7185f8707..a4d0164ba35e 100644
--- a/drivers/firmware/efi/libstub/x86-stub.c
+++ b/drivers/firmware/efi/libstub/x86-stub.c
@@ -566,16 +566,13 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
/* Convert unicode cmdline to ascii */
cmdline_ptr = efi_convert_cmdline(image, &options_size);
if (!cmdline_ptr)
- goto fail;
+ efi_exit(handle, EFI_OUT_OF_RESOURCES);
efi_set_u64_split((unsigned long)cmdline_ptr, &hdr->cmd_line_ptr,
&boot_params.ext_cmd_line_ptr);
efi_stub_entry(handle, sys_table_arg, &boot_params);
/* not reached */
-
-fail:
- efi_exit(handle, status);
}
static void add_e820ext(struct boot_params *params,
--
2.45.2.803.g4e1b14247a-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] x86/efistub: Drop redundant clearing of BSS
2024-07-04 12:46 [PATCH 1/2] x86/efistub: Avoid returning EFI_SUCCESS on error Ard Biesheuvel
@ 2024-07-04 12:46 ` Ard Biesheuvel
0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2024-07-04 12:46 UTC (permalink / raw)
To: linux-efi; +Cc: Ard Biesheuvel
From: Ard Biesheuvel <ardb@kernel.org>
As it turns out, clearing the BSS was not the right fix for the issue
that was ultimately fixed by commit decd347c2a75 ("x86/efistub:
Reinstate soft limit for initrd loading"), and given that the Windows
EFI loader becomes very unhappy when entered with garbage in BSS, this
is one thing that x86 PC EFI implementations can be expected to get
right.
So drop it from the pure PE entrypoint. The handover protocol entrypoint
still needs this - it is used by the flaky distro bootloaders that
barely implement PE/COFF at all.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
drivers/firmware/efi/libstub/x86-stub.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
index a4d0164ba35e..1ed94b251c58 100644
--- a/drivers/firmware/efi/libstub/x86-stub.c
+++ b/drivers/firmware/efi/libstub/x86-stub.c
@@ -541,9 +541,6 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
efi_status_t status;
char *cmdline_ptr;
- if (efi_is_native())
- memset(_bss, 0, _ebss - _bss);
-
efi_system_table = sys_table_arg;
/* Check if we were booted by the EFI firmware */
--
2.45.2.803.g4e1b14247a-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-04 12:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-04 12:46 [PATCH 1/2] x86/efistub: Avoid returning EFI_SUCCESS on error Ard Biesheuvel
2024-07-04 12:46 ` [PATCH 2/2] x86/efistub: Drop redundant clearing of BSS Ard Biesheuvel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).