On Thu, 5 Oct 2023 10:17:46 -0700 "Paul E. McKenney" <paul...@kernel.org> 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. > It is also useful when booting the next kernel via kexec(), in which > case it is necessary to supply only those kernel command-line arguments > from the boot loader, and most definitely not those that were embedded > into the current kernel. > > Therefore, add comments to /proc/bootconfig of the form: > > # Parameters from bootloader: > # root=UUID=ac0f0548-a69d-43ca-a06b-7db01bcbd5ad ro quiet ... > > The second added line shows only those kernel boot parameters supplied > by the boot loader. Thanks for update it. This looks good to me. Acked-by: Masami Hiramatsu (Google) <mhira...@kernel.org> Thank you! > > Link: > https://lore.kernel.org/all/CAHk-=wjpvaw3irq_bfknvfs0ztash_at67bqbg11b4w6niy...@mail.gmail.com/ > Link: https://lore.kernel.org/all/20230731233130.424913-1-paul...@kernel.org/ > Co-developed-by: Masami Hiramatsu <mhira...@kernel.org> > Signed-off-by: Masami Hiramatsu <mhira...@kernel.org> > Signed-off-by: Paul E. McKenney <paul...@kernel.org> > Cc: Linus Torvalds <torva...@linux-foundation.org> > Cc: Stephen Rothwell <s...@canb.auug.org.au> > Cc: Arnd Bergmann <a...@kernel.org> > Cc: Nick Desaulniers <ndesaulni...@google.com> > Cc: Alexey Dobriyan <adobri...@gmail.com> > Cc: Andrew Morton <a...@linux-foundation.org> > Cc: Kees Cook <keesc...@chromium.org> > Cc: <linux-trace-ker...@vger.kernel.org> > Cc: <linux-fsde...@vger.kernel.org> > --- > fs/proc/bootconfig.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/fs/proc/bootconfig.c b/fs/proc/bootconfig.c > index 2e244ada1f97..902b326e1e56 100644 > --- a/fs/proc/bootconfig.c > +++ b/fs/proc/bootconfig.c > @@ -62,6 +62,12 @@ static int __init copy_xbc_key_value_list(char *dst, > size_t size) > break; > dst += ret; > } > + if (ret >= 0 && boot_command_line[0]) { > + ret = snprintf(dst, rest(dst, end), "# Parameters from > bootloader:\n# %s\n", > + boot_command_line); > + if (ret > 0) > + dst += ret; > + } > } > out: > kfree(key); > -- > 2.40.1 > -- Masami Hiramatsu (Google) <mhira...@kernel.org>