public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] efi/libstub: Free correct pointer on failure
@ 2024-11-15  9:28 Ard Biesheuvel
  2024-11-15  9:28 ` [PATCH 2/4] efi/libstub: Parse builtin command line after bootloader provided one Ard Biesheuvel
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ard Biesheuvel @ 2024-11-15  9:28 UTC (permalink / raw)
  To: linux-efi; +Cc: Jonathan Marek, Ard Biesheuvel

From: Ard Biesheuvel <ardb@kernel.org>

cmdline_ptr is an out parameter, which is not allocated by the function
itself, and likely points into the caller's stack.

cmdline refers to the pool allocation that should be freed when cleaning
up after a failure, so pass this instead to free_pool().

Fixes: 42c8ea3dca09 ("efi: libstub: Factor out EFI stub entrypoint ...")
Cc: <stable@vger.kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 drivers/firmware/efi/libstub/efi-stub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi/libstub/efi-stub.c
index f09e277ba210..fc71dcab43e0 100644
--- a/drivers/firmware/efi/libstub/efi-stub.c
+++ b/drivers/firmware/efi/libstub/efi-stub.c
@@ -148,7 +148,7 @@ efi_status_t efi_handle_cmdline(efi_loaded_image_t *image, char **cmdline_ptr)
 	return EFI_SUCCESS;
 
 fail_free_cmdline:
-	efi_bs_call(free_pool, cmdline_ptr);
+	efi_bs_call(free_pool, cmdline);
 	return status;
 }
 
-- 
2.47.0.338.g60cca15819-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH 0/4] efi/libstub: Clean up command line handling
@ 2024-10-15 18:15 Ard Biesheuvel
  2024-10-15 18:15 ` [PATCH 4/4] efi/libstub: Take command line overrides into account for loaded files Ard Biesheuvel
  0 siblings, 1 reply; 5+ messages in thread
From: Ard Biesheuvel @ 2024-10-15 18:15 UTC (permalink / raw)
  To: linux-efi; +Cc: Ard Biesheuvel, Jonathan Marek

From: Ard Biesheuvel <ardb@kernel.org>

This is a follow-up to the patches sent out by Jonathan last week
[0][1], to fix the broken command line handling in the EFI stub, which
currently fails to use the built-on command line as a fallback as it
never considers the bootloader provided command line to be empty.

This series fixes some more identified issues:
- free the correct pointer on error
- parse the built-in command line *after* the bootloader provided one,
  if both are available, to match the core kernel's behavior
- implement the missing fallback handling when loading files provided on
  the command line via initrd= or dtb=
- ignore the bootloader provided command line when FORCE or OVERRIDE are
  configured

The latter is provided as a separate change, as it changes behavior in a
way that could result in regressions, however unlikely.

[0] https://lore.kernel.org/all/20241011224812.25763-1-jonathan@marek.ca/#r
[1] https://lore.kernel.org/all/CAMj1kXGbuZnM8GoHasWNxs2YOnUDL-JViRmvGdVc91WHkMbdqA@mail.gmail.com/T/#u

Cc: Jonathan Marek <jonathan@marek.ca>

Ard Biesheuvel (4):
  efi/libstub: Free correct pointer on failure
  efi/libstub: Parse builtin command line after bootloader provided one
  efi/libstub: Fix command line fallback handling when loading files
  efi/libstub: Take command line overrides into account for loaded files

 drivers/firmware/efi/libstub/efi-stub.c | 21 +++++++++-----------
 drivers/firmware/efi/libstub/file.c     | 21 ++++++++++++++++++++
 2 files changed, 30 insertions(+), 12 deletions(-)

-- 
2.47.0.rc1.288.g06298d1525-goog


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-11-15  9:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-15  9:28 [PATCH 1/4] efi/libstub: Free correct pointer on failure Ard Biesheuvel
2024-11-15  9:28 ` [PATCH 2/4] efi/libstub: Parse builtin command line after bootloader provided one Ard Biesheuvel
2024-11-15  9:28 ` [PATCH 3/4] efi/libstub: Fix command line fallback handling when loading files Ard Biesheuvel
2024-11-15  9:28 ` [PATCH 4/4] efi/libstub: Take command line overrides into account for loaded files Ard Biesheuvel
  -- strict thread matches above, loose matches on Subject: below --
2024-10-15 18:15 [PATCH 0/4] efi/libstub: Clean up command line handling Ard Biesheuvel
2024-10-15 18:15 ` [PATCH 4/4] efi/libstub: Take command line overrides into account for loaded files Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox