The patch titled Subject: fs/proc: add boot loader arguments as comment to /proc/bootconfig has been added to the -mm mm-nonmm-unstable branch. Its filename is fs-proc-add-boot-loader-arguments-as-comment-to-proc-bootconfig.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/fs-proc-add-boot-loader-arguments-as-comment-to-proc-bootconfig.patch This patch will later appear in the mm-nonmm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: "Paul E. McKenney" <paulmck@xxxxxxxxxx> Subject: fs/proc: add boot loader arguments as comment to /proc/bootconfig Date: Thu, 5 Oct 2023 10:17:46 -0700 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. Link: https://lore.kernel.org/all/CAHk-=wjpVAW3iRq_bfKnVfs0ZtASh_aT67bQBG11b4W6niYVUw@xxxxxxxxxxxxxx/ Link: https://lore.kernel.org/all/20230731233130.424913-1-paulmck@xxxxxxxxxx/ Link: https://lkml.kernel.org/r/20231005171747.541123-2-paulmck@xxxxxxxxxx Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxx> Co-developed-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx> Signed-off-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx> Acked-by: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> Cc: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> Cc: Arnd Bergmann <arnd@xxxxxxxxxx> Cc: Nick Desaulniers <ndesaulniers@xxxxxxxxxx> Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx> Cc: Kees Cook <keescook@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/proc/bootconfig.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/fs/proc/bootconfig.c~fs-proc-add-boot-loader-arguments-as-comment-to-proc-bootconfig +++ a/fs/proc/bootconfig.c @@ -62,6 +62,12 @@ static int __init copy_xbc_key_value_lis 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); _ Patches currently in -mm which might be from paulmck@xxxxxxxxxx are fs-proc-add-boot-loader-arguments-as-comment-to-proc-bootconfig.patch