[PATCH v2 2/2] init/Kconfig: make config INIT_ENV_ARG_LIMIT user-configurable

Wilson Felipe Pereira <[email protected]>
Newsgroups org.kernel.vger.linux-arch,org.infradead.lists.linux-riscv,org.kernel.vger.linux-kernel,org.kernel.vger.linux-s390
Message-ID <[email protected]>
INIT_ENV_ARG_LIMIT is defined without a prompt string (`int`), making it
a hidden Kconfig symbol that defaults to 32 (or 128 for UML) and cannot
be configured in `make menuconfig`.

Now that CONFIG_COMMAND_LINE_SIZE is configurable across all architectures,
users who select larger kernel command lines (e.g., 4096 bytes) may pass
more than 32 command-line arguments or environment variables (`foo=bar`) to
`/sbin/init`. If INIT_ENV_ARG_LIMIT remains hardcoded at 32, any argument
after the 32nd sets the panic_later flag and causes a hard kernel panic
on boot.

Add a prompt string ("Maximum number of kernel command line arguments") and
a `range 32 4096` to `config INIT_ENV_ARG_LIMIT` so that users can
configure their init argument and environment variable limit when needed,
while preserving the existing default of 32 for standard builds.

Signed-off-by: Maciej Żenczykowski <[email protected]>
Signed-off-by: Wilson Felipe Pereira <[email protected]>
---
 init/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/init/Kconfig b/init/Kconfig
index d03d42ecb0e9..bdd66dc7f628 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -231,9 +231,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
 	help
 	  Maximum of each of the number of arguments and environment
 	  variables passed to init from the kernel command line.
-- 
2.55.0.737.g08866a6d13-goog
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.