* Re: [PATCH] init/main.c: Wrap long kernel cmdline when printing to logs
[not found] ` <CAD=FV=WeXOj_hyA=V9hMLHOJ_m9ui5mP6cRv2DpjXnR62_nd2w@mail.gmail.com>
@ 2025-10-21 7:05 ` Geert Uytterhoeven
2025-10-21 13:16 ` Heiko Carstens
0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2025-10-21 7:05 UTC (permalink / raw)
To: Doug Anderson
Cc: Randy Dunlap, linux-kernel, Andrew Chant, Alexander Shishkin,
Andrew Morton, Brian Gerst, Christian Brauner, Francesco Valla,
Guo Weikang, Huacai Chen, Jan Hendrik Farr, Jeff Xu, Kees Cook,
Masahiro Yamada, Michal Koutný, Miguel Ojeda,
Mike Rapoport (Microsoft), Nathan Chancellor, Peter Zijlstra,
Shakeel Butt, Tejun Heo, Thomas Gleixner, Thomas Weißschuh,
Uladzislau Rezki (Sony), Sven Schnelle, linux-s390
Hi Doug,
CC s390
On Mon, 20 Oct 2025 at 18:04, Doug Anderson <dianders@chromium.org> wrote:
> On Mon, Oct 20, 2025 at 8:42 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Mon, 20 Oct 2025 at 17:33, Doug Anderson <dianders@chromium.org> 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@linux-m68k.org
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] init/main.c: Wrap long kernel cmdline when printing to logs
2025-10-21 7:05 ` [PATCH] init/main.c: Wrap long kernel cmdline when printing to logs Geert Uytterhoeven
@ 2025-10-21 13:16 ` Heiko Carstens
2025-10-21 16:07 ` Doug Anderson
0 siblings, 1 reply; 3+ messages in thread
From: Heiko Carstens @ 2025-10-21 13:16 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Doug Anderson, Randy Dunlap, linux-kernel, Andrew Chant,
Alexander Shishkin, Andrew Morton, Brian Gerst, Christian Brauner,
Francesco Valla, Guo Weikang, Huacai Chen, Jan Hendrik Farr,
Jeff Xu, Kees Cook, Masahiro Yamada, Michal Koutný,
Miguel Ojeda, Mike Rapoport (Microsoft), Nathan Chancellor,
Peter Zijlstra, Shakeel Butt, Tejun Heo, Thomas Gleixner,
Thomas Weißschuh, Uladzislau Rezki (Sony), Sven Schnelle,
linux-s390
On Tue, Oct 21, 2025 at 09:05:48AM +0200, Geert Uytterhoeven wrote:
> On Mon, 20 Oct 2025 at 18:04, Doug Anderson <dianders@chromium.org> wrote:
> > On Mon, Oct 20, 2025 at 8:42 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > > On Mon, 20 Oct 2025 at 17:33, Doug Anderson <dianders@chromium.org> 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.
That was just a follow-on patch of commit 5ecb2da660ab ("s390: support command
lines longer than 896 bytes") which solved the real problem with a too short
maximum command line size back then. In order to never have to deal with this
sort of problem again it was made configurable.
But I doubt that anybody will change the default ever.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] init/main.c: Wrap long kernel cmdline when printing to logs
2025-10-21 13:16 ` Heiko Carstens
@ 2025-10-21 16:07 ` Doug Anderson
0 siblings, 0 replies; 3+ messages in thread
From: Doug Anderson @ 2025-10-21 16:07 UTC (permalink / raw)
To: Heiko Carstens
Cc: Geert Uytterhoeven, Randy Dunlap, linux-kernel, Andrew Chant,
Alexander Shishkin, Andrew Morton, Brian Gerst, Christian Brauner,
Francesco Valla, Guo Weikang, Huacai Chen, Jan Hendrik Farr,
Jeff Xu, Kees Cook, Masahiro Yamada, Michal Koutný,
Miguel Ojeda, Mike Rapoport (Microsoft), Nathan Chancellor,
Peter Zijlstra, Shakeel Butt, Tejun Heo, Thomas Gleixner,
Thomas Weißschuh, Uladzislau Rezki (Sony), Sven Schnelle,
linux-s390
Hi,
On Tue, Oct 21, 2025 at 6:16 AM Heiko Carstens <hca@linux.ibm.com> wrote:
>
> On Tue, Oct 21, 2025 at 09:05:48AM +0200, Geert Uytterhoeven wrote:
> > On Mon, 20 Oct 2025 at 18:04, Doug Anderson <dianders@chromium.org> wrote:
> > > On Mon, Oct 20, 2025 at 8:42 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > > > On Mon, 20 Oct 2025 at 17:33, Doug Anderson <dianders@chromium.org> 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.
>
> That was just a follow-on patch of commit 5ecb2da660ab ("s390: support command
> lines longer than 896 bytes") which solved the real problem with a too short
> maximum command line size back then. In order to never have to deal with this
> sort of problem again it was made configurable.
>
> But I doubt that anybody will change the default ever.
OK, so my theory that 1MB cmdline is not normal / realistic / expected
sounds correct. Essentially it's just saying "we didn't want to pick a
limit". We could add a bound to what's printed if we want (4K? 16K?),
but it's maybe not critical since we wouldn't expect crazy long
cmdlines anyway.
So I guess the question is whether any of my arguments convinced
Andrew that my current wrapping logic is OK. If not, hopefully he can
clarify if either of my theories of what he meant by "chunking" were
correct and then I can send a v2. ;-)
Of course, given that the max cmdline for most architectures is
something like 2K/4K, it also might not be too horrible to just
increase the printk limit? I was assuming that would be too
controversial...
-Doug
-Doug
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-21 16:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20251019100605.1.I095f1e2c6c27f9f4de0b4841f725f356c643a13f@changeid>
[not found] ` <2d514d61-121d-44fc-aec7-637dd0920de8@infradead.org>
[not found] ` <CAD=FV=VNyt1zG_8pS64wgV8VkZWiWJymnZ-XCfkrfaAhhFSKcA@mail.gmail.com>
[not found] ` <CAMuHMdVT-_UVAO=1jvTPEjKO0zy7H1rUrQz1ubMfHivF4HWJNA@mail.gmail.com>
[not found] ` <CAD=FV=WeXOj_hyA=V9hMLHOJ_m9ui5mP6cRv2DpjXnR62_nd2w@mail.gmail.com>
2025-10-21 7:05 ` [PATCH] init/main.c: Wrap long kernel cmdline when printing to logs Geert Uytterhoeven
2025-10-21 13:16 ` Heiko Carstens
2025-10-21 16:07 ` Doug Anderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox