]> git.itanic.dy.fi Git - linux-stable/commit
fs/proc: Add boot loader arguments as comment to /proc/bootconfig
authorPaul E. McKenney <paulmck@kernel.org>
Thu, 5 Oct 2023 17:17:46 +0000 (10:17 -0700)
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>
Sat, 7 Oct 2023 01:45:56 +0000 (10:45 +0900)
commit717c7c894d4b885e879790f14afbe630802d77d7
treec9d373f3cc44184f18f8bee831c4983cbcea8d02
parent1c20c65ea03293bcb08765d320ae32a27b56224b
fs/proc: Add boot loader arguments as comment to /proc/bootconfig

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/20231005171747.541123-2-paulmck@kernel.org/
Link: https://lore.kernel.org/all/CAHk-=wjpVAW3iRq_bfKnVfs0ZtASh_aT67bQBG11b4W6niYVUw@mail.gmail.com/
Link: https://lore.kernel.org/all/20230731233130.424913-1-paulmck@kernel.org/
Co-developed-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Arnd Bergmann <arnd@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: <linux-trace-kernel@vger.kernel.org>
Cc: <linux-fsdevel@vger.kernel.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
fs/proc/bootconfig.c