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: <CAMj1kXHgFVs5Gt5hNao6DTZxqw4dO89OuUMH2tvdWPY1kxfc0Q@mail.gmail.com>
Date: Sat, 12 Oct 2024 09:54:44 +0200
From: Ard Biesheuvel <ardb@...nel.org>
To: Jonathan Marek <jonathan@...ek.ca>
Cc: linux-efi@...r.kernel.org, open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/3] efi/libstub: consider CONFIG_CMDLINE for initrd= and
 dtb= options

On Sat, 12 Oct 2024 at 00:52, Jonathan Marek <jonathan@...ek.ca> wrote:
>
> Replace cmdline with CONFIG_CMDLINE when it should be used instead of
> load_options.
>
> In the EXTEND case, it may be necessary to combine both CONFIG_CMDLINE and
> load_options. In that case, keep the old behavior and print a warning about
> the incorrect behavior.
>

The core kernel has its own handling for EXTEND/FORCE, so while we
should parse it in the EFI stub to look for options that affect the
stub's own behavior, we should not copy it into the command line that
the stub provides to the core kernel.

E.g., drivers/of/fdt.c takes the bootargs from the DT and combines
them with CONFIG_CMDLINE.


> Signed-off-by: Jonathan Marek <jonathan@...ek.ca>
> ---
>  drivers/firmware/efi/libstub/file.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/drivers/firmware/efi/libstub/file.c b/drivers/firmware/efi/libstub/file.c
> index d6a025df07dcf..2a69e2b3583d4 100644
> --- a/drivers/firmware/efi/libstub/file.c
> +++ b/drivers/firmware/efi/libstub/file.c
> @@ -208,6 +208,18 @@ efi_status_t handle_cmdline_files(efi_loaded_image_t *image,
>         if (IS_ENABLED(CONFIG_X86) && !efi_nochunk)
>                 efi_chunk_size = EFI_READ_CHUNK_SIZE;
>
> +       if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) ||
> +           IS_ENABLED(CONFIG_CMDLINE_FORCE) ||
> +           cmdline_len == 0) {
> +               if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && cmdline_len > 0) {
> +                       /* both CONFIG_CMDLINE and load_options should be used */
> +                       efi_warn("ignoring %ls from CONFIG_CMDLINE\n", optstr);
> +               } else {
> +                       cmdline = L"" CONFIG_CMDLINE;
> +                       cmdline_len = ARRAY_SIZE(L"" CONFIG_CMDLINE) - 1;
> +               }
> +       }
> +
>         alloc_addr = alloc_size = 0;
>         do {
>                 struct finfo fi;
> --
> 2.45.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ