All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Wilson Felipe Pereira" <wfelipe@google.com>
Cc: linux-s390@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	"Vasily Gorbik" <gor@linux.ibm.com>
Subject: Re: [PATCH 3/3] init/Kconfig: make config INIT_ENV_ARG_LIMIT user-configurable
Date: Thu, 06 Aug 2026 06:29:52 +0000	[thread overview]
Message-ID: <20260806062953.417D61F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260806061429.474992-4-wfelipe@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] init_setup() and rdinit_setup() fail to clear argv_init[MAX_INIT_ARGS], leading to a ghost argument or spurious kernel panic.
--

--- Patch [3]: [PATCH 3/3] init/Kconfig: make config INIT_ENV_ARG_LIMIT user-configurable ---
commit 40d27a1b9f7dbca831686327245c33052b28fb18
Author: Wilson Felipe Pereira <wfelipe@google.com>

init/Kconfig: make config INIT_ENV_ARG_LIMIT user-configurable

This commit makes the INIT_ENV_ARG_LIMIT Kconfig symbol user-configurable
by adding a prompt string and a valid range. This allows users to increase
the maximum number of kernel command-line arguments passed to init beyond
the default.

> diff --git a/init/Kconfig b/init/Kconfig
> index c581817966ee2..a77a2c33c319c 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -228,9 +228,10 @@ config BROKEN_ON_SMP
>  	default y
>  
>  config INIT_ENV_ARG_LIMIT
> -	int
> +	int "Maximum number of kernel command line arguments"
>  	default 32 if !UML
>  	default 128 if UML
> +	range 32 4096

[Severity: High]
This is a pre-existing issue, but could making this limit configurable 
expose a bug in init_setup() and rdinit_setup() where they fail to clear 
the last element of argv_init?

Looking at init_setup() in init/main.c:

init/main.c:init_setup() {
    ...
	for (i = 1; i < MAX_INIT_ARGS; i++)
		argv_init[i] = NULL;
    ...
}

And similarly in rdinit_setup():

init/main.c:rdinit_setup() {
    ...
	for (i = 1; i < MAX_INIT_ARGS; i++)
		argv_init[i] = NULL;
    ...
}

Since argv_init is sized MAX_INIT_ARGS + 2, if the boot command line includes 
exactly MAX_INIT_ARGS unknown arguments before 'init=', they populate 
argv_init[1] through argv_init[MAX_INIT_ARGS]. The loop in init_setup() stops 
at MAX_INIT_ARGS - 1, leaving argv_init[MAX_INIT_ARGS] populated with a stale 
argument.

If the boot command line then provides MAX_INIT_ARGS - 1 arguments after 
'init=', they fill indices 1 to MAX_INIT_ARGS - 1. This makes the uncleared 
argv_init[MAX_INIT_ARGS] contiguous, which could cause kernel_execve to 
pass it to init as a ghost argument. 

Alternatively, if exactly MAX_INIT_ARGS arguments are provided after 'init=',
could the argument checking loop evaluate argv_init[MAX_INIT_ARGS] as true,
set panic_later, and cause a spurious boot panic?

>  	help
>  	  Maximum of each of the number of arguments and environment
>  	  variables passed to init from the kernel command line.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260806061429.474992-1-wfelipe@google.com?part=3

  reply	other threads:[~2026-08-06  6:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06  6:14 [PATCH 0/3] init/Kconfig: generalize config COMMAND_LINE_SIZE Wilson Felipe Pereira
2026-08-06  6:14 ` Wilson Felipe Pereira
2026-08-06  6:14 ` [PATCH 1/3] init/Kconfig: generalize config COMMAND_LINE_SIZE to all architectures Wilson Felipe Pereira
2026-08-06  6:14   ` Wilson Felipe Pereira
2026-08-06  6:26   ` sashiko-bot
2026-08-06  6:14 ` [PATCH 2/3] arch: use CONFIG_COMMAND_LINE_SIZE across " Wilson Felipe Pereira
2026-08-06  6:14   ` Wilson Felipe Pereira
2026-08-06  6:25   ` sashiko-bot
2026-08-06  6:14 ` [PATCH 3/3] init/Kconfig: make config INIT_ENV_ARG_LIMIT user-configurable Wilson Felipe Pereira
2026-08-06  6:14   ` Wilson Felipe Pereira
2026-08-06  6:29   ` sashiko-bot [this message]
2026-08-06 22:57 ` [PATCH 0/3] init/Kconfig: generalize config COMMAND_LINE_SIZE Andrew Morton
2026-08-06 22:57   ` Andrew Morton

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=20260806062953.417D61F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wfelipe@google.com \
    /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.