lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMj1kXFstg+2j9nYCO=_=L3LAd4PYc5vO3OX4EtHfFA90BXv5Q@mail.gmail.com>
Date: Sat, 12 Oct 2024 09:46:26 +0200
From: Ard Biesheuvel <ardb@...nel.org>
To: Jonathan Marek <jonathan@...ek.ca>
Cc: linux-efi@...r.kernel.org, 
	Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>, Ingo Molnar <mingo@...nel.org>, 
	open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] efi/libstub: fix efi_parse_options() ignoring the
 default command line

Hi Jonathan,

Please use a cover letter when sending more than a single patch.

On Sat, 12 Oct 2024 at 00:51, Jonathan Marek <jonathan@...ek.ca> wrote:
>
> efi_convert_cmdline() always returns a size of at least 1 because it counts
> the NUL terminator, so the "cmdline_size == 0" condition is not possible.
>
> Change it to compare against 1 to get the intended behavior: to use
> CONFIG_CMDLINE when load_options_size is 0.
>
> Fixes: 60f38de7a8d4 ("efi/libstub: Unify command line param parsing")
> Signed-off-by: Jonathan Marek <jonathan@...ek.ca>
> ---
>  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 958a680e0660d..709ae2d41a632 100644
> --- a/drivers/firmware/efi/libstub/efi-stub.c
> +++ b/drivers/firmware/efi/libstub/efi-stub.c
> @@ -129,7 +129,7 @@ efi_status_t efi_handle_cmdline(efi_loaded_image_t *image, char **cmdline_ptr)
>
>         if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) ||
>             IS_ENABLED(CONFIG_CMDLINE_FORCE) ||
> -           cmdline_size == 0) {
> +           cmdline_size == 1) {

I'd prefer it if we could keep the weirdness local to
efi_convert_cmdline(). Would the below fix things too?

--- a/drivers/firmware/efi/libstub/efi-stub-helper.c
+++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
@@ -395,9 +395,7 @@
                }
        }

-       options_bytes++;        /* NUL termination */
-
-       status = efi_bs_call(allocate_pool, EFI_LOADER_DATA, options_bytes,
+       status = efi_bs_call(allocate_pool, EFI_LOADER_DATA, options_bytes + 1,
                             (void **)&cmdline_addr);
        if (status != EFI_SUCCESS)
                return NULL;

Note that the only other caller of efi_convert_cmdline() in x86-stub.c
ignores this value entirely.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ