Re: [PATCH RFC bootconfig] 1/2] fs/proc: Add /proc/cmdline_load for boot loader arguments
From: Google
Date: Sun Aug 06 2023 - 22:45:12 EST
On Fri, 4 Aug 2023 10:36:17 -0700
"Paul E. McKenney" <paulmck@xxxxxxxxxx> wrote:
> On Fri, Aug 04, 2023 at 08:23:20PM +0300, Alexey Dobriyan wrote:
> > On Thu, Jul 27, 2023 at 08:37:00PM -0700, Paul E. McKenney wrote:
> > > In kernels built with CONFIG_BOOT_CONFIG_FORCE=y, /proc/cmdline will
> > > show all kernel boot parameters, both those supplied by the boot loader
> > > and those embedded in the kernel image. This works well for those who
> > > just want to see all of the kernel boot parameters, but is not helpful to
> > > those who need to see only those parameters supplied by the boot loader.
> > > This is especially important when these parameters are presented to the
> > > boot loader by automation that might gather them from diverse sources.
> > >
> > > Therefore, provide a /proc/cmdline_load file that shows only those kernel
> > > boot parameters supplied by the boot loader.
> >
> > > +static int cmdline_load_proc_show(struct seq_file *m, void *v)
> > > +{
> > > + seq_puts(m, boot_command_line);
> > > + seq_putc(m, '\n');
> > > + return 0;
> > > +}
> > > +
> > > static int __init proc_cmdline_init(void)
> > > {
> > > struct proc_dir_entry *pde;
> > > @@ -19,6 +27,11 @@ static int __init proc_cmdline_init(void)
> > > pde = proc_create_single("cmdline", 0, NULL, cmdline_proc_show);
> > > pde_make_permanent(pde);
> > > pde->size = saved_command_line_len + 1;
> > > + if (IS_ENABLED(CONFIG_BOOT_CONFIG_FORCE)) {
> > > + pde = proc_create_single("cmdline_load", 0, NULL, cmdline_load_proc_show);
> > > + pde_make_permanent(pde);
> > > + pde->size = strnlen(boot_command_line, COMMAND_LINE_SIZE) + 1;
> > > + }
> >
> > Please add it as separate fs/proc/cmdline_load.c file so that name of
> > the file matches name of the /proc file.
>
> Thank you, will do!
>
> > The name "cmdline_load" is kind of non-descriptive. Mentioning "bootloader"
> > somewhere should improve things.
>
> If we can all quickly come to agreement on a name, I can of course easily
> change it.
>
> /proc/cmdline_bootloader? Better than /proc/cmdline_from_bootloader,
> I suppose. /proc/cmdline_bootldr? /proc/bootloader by analogy with
> /proc/bootconfig? Something else?
What about "/proc/raw_cmdline" ?
Thank you,
>
> Thanx, Paul
--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>