Re: [PATCH] init/main.c: Wrap long kernel cmdline when printing to logs

From: Geert Uytterhoeven

Date: Tue Oct 21 2025 - 03:12:32 EST


Hi Doug,

CC s390

On Mon, 20 Oct 2025 at 18:04, Doug Anderson <dianders@xxxxxxxxxxxx> wrote:
> On Mon, Oct 20, 2025 at 8:42 AM Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
> > On Mon, 20 Oct 2025 at 17:33, Doug Anderson <dianders@xxxxxxxxxxxx> wrote:
> > > Printing the command line to the kernel log buffer is one of the very
> > > rare cases where:
> > > * There's a legitimate reason to print a (potentially) very long
> > > string to the kernel buffer.
> >
> > arch/s390/Kconfig:
> >
> > config COMMAND_LINE_SIZE
> > int "Maximum size of kernel command line"
> > default 4096
> > range 896 1048576
> >
> > Yummy...
>
> Wow, what are they expecting to stuff in there? An encoded initramfs
> or something? I kinda feel like the 1MB number isn't something anyone
> expects but is a number picked to effectively be "unlimited".

Dunno, commit 622021cd6c560ce7 ("s390: make command line configurable")
lacks the "why" part.

> Do you have a suggestion of what my code should do if it sees such a
> long cmdline? At small numbers (4K, 8K, maybe even 32K) printing the
> wrapped cmdline is nice. Above that, maybe it should just print
> something like "<cmdline truncated>" or something?

I don't know, I never saw truncated kernel command lines myself.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds