All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Breno Leitao" <leitao@debian.org>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH v4 7/7] x86/setup: prepend embedded bootconfig cmdline before parse_early_param
Date: Tue, 09 Jun 2026 10:48:23 +0000	[thread overview]
Message-ID: <20260609104824.5F79F1F0089C@smtp.kernel.org> (raw)
In-Reply-To: <20260609-bootconfig_using_tools-v4-7-73c463f03a97@debian.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Embedded bootconfig parameters leak into the kernel command line when an initrd bootconfig is provided, violating the override priority and creating duplicate keys.
--

commit 9c00cec56ea23ba4a68bbf333ebf81d192d7c851
Author: Breno Leitao <leitao@debian.org>

x86/setup: prepend embedded bootconfig cmdline before parse_early_param

This commit modifies setup_arch() to fold the embedded bootconfig
"kernel" subtree into the boot_command_line early. This allows
early_param() handlers to see values supplied via the embedded
bootconfig without parsing bootconfig at runtime.

> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
[ ... ]
> @@ -924,6 +926,31 @@ void __init setup_arch(char **cmdline_p)
>  	builtin_cmdline_added = true;
>  #endif
>  
> +	/*
> +	 * Match the runtime bootconfig parser's opt-in: only fold the
[ ... ]
> +	 * unconditionally.
> +	 */
> +	{
> +		char buf[8];
> +
> +		if (IS_ENABLED(CONFIG_BOOT_CONFIG_FORCE) ||
> +		    cmdline_find_option_bool(boot_command_line, "bootconfig") ||
> +		    cmdline_find_option(boot_command_line, "bootconfig",
> +					buf, sizeof(buf)) >= 0)
> +			xbc_prepend_embedded_cmdline(boot_command_line,
> +						     COMMAND_LINE_SIZE);

[Severity: High]
If an initrd bootconfig is present, does prepending the embedded bootconfig
here in setup_arch() defeat the ability for the initrd bootconfig to
override it?

Because the embedded bootconfig is prepended to boot_command_line before
the initrd is checked, early parameters (like mem= or earlycon=) will only
ever see the embedded bootconfig values.

> +	}
> +
>  	strscpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
>  	*cmdline_p = command_line;

> diff --git a/init/main.c b/init/main.c
> --- a/init/main.c
> +++ b/init/main.c
[ ... ]
> @@ -378,12 +378,15 @@ static void __init setup_boot_config(void)
>  	int pos, ret;
>  	size_t size;
>  	char *err;
> +	bool from_embedded = false;
>  
>  	/* Cut out the bootconfig data even if we have no bootconfig option */
>  	data = get_boot_config_from_initrd(&size);
>  	/* If there is no bootconfig in initrd, try embedded one. */
> -	if (!data)
> +	if (!data) {
>  		data = xbc_get_embedded_bootconfig(&size);
> +		from_embedded = true;
> +	}

[Severity: High]
When setup_boot_config() discovers an initrd bootconfig, data will be
non-NULL and from_embedded will be false.

Won't this lead to extra_command_line containing the initrd keys, while
boot_command_line already contains the embedded keys prepended earlier?

This seems like it would cause both sets of keys to be merged into
saved_command_line, potentially creating conflicting or duplicate
arguments. Is there a way to defer or override the embedded keys if an
initrd bootconfig is provided?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260609-bootconfig_using_tools-v4-0-73c463f03a97@debian.org?part=7

      reply	other threads:[~2026-06-09 10:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09 10:28 [PATCH v4 0/7] bootconfig: embed kernel.* cmdline at build time Breno Leitao
2026-06-09 10:28 ` [PATCH v4 1/7] bootconfig: fix NULL-pointer arithmetic in xbc_snprint_cmdline() Breno Leitao
2026-06-09 10:28 ` [PATCH v4 2/7] bootconfig: render descendant keys when xbc_snprint_cmdline() root has a value Breno Leitao
2026-06-09 10:28 ` [PATCH v4 3/7] bootconfig: render embedded bootconfig as a kernel cmdline at build time Breno Leitao
2026-06-10 13:44   ` Julian Braha
2026-06-10 14:50     ` Breno Leitao
2026-06-09 10:28 ` [PATCH v4 4/7] bootconfig: clean build-time tools/bootconfig from make clean Breno Leitao
2026-06-09 10:28 ` [PATCH v4 5/7] bootconfig: add xbc_prepend_embedded_cmdline() helper Breno Leitao
2026-06-09 10:28 ` [PATCH v4 6/7] Documentation: bootconfig: document build-time cmdline rendering Breno Leitao
2026-06-10 14:37   ` Masami Hiramatsu
2026-06-10 14:58     ` Breno Leitao
2026-06-09 10:28 ` [PATCH v4 7/7] x86/setup: prepend embedded bootconfig cmdline before parse_early_param Breno Leitao
2026-06-09 10:48   ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260609104824.5F79F1F0089C@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=leitao@debian.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.