* [PATCH bootconfig 2/3] fs/proc: Add boot loader arguments as comment to /proc/bootconfig [not found] <6ea609a4-12e3-4266-8816-b9fca1f1f21c@paulmck-laptop> @ 2023-10-05 17:17 ` Paul E. McKenney 2023-10-06 8:59 ` Masami Hiramatsu 0 siblings, 1 reply; 5+ messages in thread From: Paul E. McKenney @ 2023-10-05 17:17 UTC (permalink / raw) To: linux-kernel, linux-fsdevel, linux-doc Cc: Jonathan Corbet, Masami Hiramatsu (Google), Paul E. McKenney, Linus Torvalds, Stephen Rothwell, Arnd Bergmann, Nick Desaulniers, Alexey Dobriyan, Andrew Morton, Kees Cook, linux-trace-kernel 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@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: 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> --- 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 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH bootconfig 2/3] fs/proc: Add boot loader arguments as comment to /proc/bootconfig 2023-10-05 17:17 ` [PATCH bootconfig 2/3] fs/proc: Add boot loader arguments as comment to /proc/bootconfig Paul E. McKenney @ 2023-10-06 8:59 ` Masami Hiramatsu 2023-10-06 16:52 ` Paul E. McKenney 0 siblings, 1 reply; 5+ messages in thread From: Masami Hiramatsu @ 2023-10-06 8:59 UTC (permalink / raw) To: Paul E. McKenney Cc: linux-kernel, linux-fsdevel, linux-doc, Jonathan Corbet, Masami Hiramatsu (Google), Linus Torvalds, Stephen Rothwell, Arnd Bergmann, Nick Desaulniers, Alexey Dobriyan, Andrew Morton, Kees Cook, linux-trace-kernel On Thu, 5 Oct 2023 10:17:46 -0700 "Paul E. McKenney" <paulmck@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) <mhiramat@kernel.org> Thank you! > > 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: 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> > --- > 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) <mhiramat@kernel.org> ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH bootconfig 2/3] fs/proc: Add boot loader arguments as comment to /proc/bootconfig 2023-10-06 8:59 ` Masami Hiramatsu @ 2023-10-06 16:52 ` Paul E. McKenney 2023-10-07 1:42 ` Masami Hiramatsu 0 siblings, 1 reply; 5+ messages in thread From: Paul E. McKenney @ 2023-10-06 16:52 UTC (permalink / raw) To: Masami Hiramatsu Cc: linux-kernel, linux-fsdevel, linux-doc, Jonathan Corbet, Linus Torvalds, Stephen Rothwell, Arnd Bergmann, Nick Desaulniers, Alexey Dobriyan, Andrew Morton, Kees Cook, linux-trace-kernel On Fri, Oct 06, 2023 at 05:59:48PM +0900, Masami Hiramatsu wrote: > On Thu, 5 Oct 2023 10:17:46 -0700 > "Paul E. McKenney" <paulmck@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) <mhiramat@kernel.org> > > Thank you! And thank you! I take this as meaning that I should push these three commits for the upcoming v6.7 merge window. Please let me know if I should be doing something else. Thanx, Paul > > 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: 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> > > --- > > 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) <mhiramat@kernel.org> ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH bootconfig 2/3] fs/proc: Add boot loader arguments as comment to /proc/bootconfig 2023-10-06 16:52 ` Paul E. McKenney @ 2023-10-07 1:42 ` Masami Hiramatsu 2023-10-07 3:42 ` Paul E. McKenney 0 siblings, 1 reply; 5+ messages in thread From: Masami Hiramatsu @ 2023-10-07 1:42 UTC (permalink / raw) To: paulmck Cc: linux-kernel, linux-fsdevel, linux-doc, Jonathan Corbet, Linus Torvalds, Stephen Rothwell, Arnd Bergmann, Nick Desaulniers, Alexey Dobriyan, Andrew Morton, Kees Cook, linux-trace-kernel On Fri, 6 Oct 2023 09:52:30 -0700 "Paul E. McKenney" <paulmck@kernel.org> wrote: > On Fri, Oct 06, 2023 at 05:59:48PM +0900, Masami Hiramatsu wrote: > > On Thu, 5 Oct 2023 10:17:46 -0700 > > "Paul E. McKenney" <paulmck@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) <mhiramat@kernel.org> > > > > Thank you! > > And thank you! I take this as meaning that I should push these three > commits for the upcoming v6.7 merge window. Please let me know if I > should be doing something else. I have my bootconfig branch, so I think I should pick this and push it to the next window. Does it work? Thank you, > > Thanx, Paul > > > > 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: 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> > > > --- > > > 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) <mhiramat@kernel.org> -- Masami Hiramatsu (Google) <mhiramat@kernel.org> ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH bootconfig 2/3] fs/proc: Add boot loader arguments as comment to /proc/bootconfig 2023-10-07 1:42 ` Masami Hiramatsu @ 2023-10-07 3:42 ` Paul E. McKenney 0 siblings, 0 replies; 5+ messages in thread From: Paul E. McKenney @ 2023-10-07 3:42 UTC (permalink / raw) To: Masami Hiramatsu Cc: linux-kernel, linux-fsdevel, linux-doc, Jonathan Corbet, Linus Torvalds, Stephen Rothwell, Arnd Bergmann, Nick Desaulniers, Alexey Dobriyan, Andrew Morton, Kees Cook, linux-trace-kernel On Sat, Oct 07, 2023 at 10:42:09AM +0900, Masami Hiramatsu wrote: > On Fri, 6 Oct 2023 09:52:30 -0700 > "Paul E. McKenney" <paulmck@kernel.org> wrote: > > > On Fri, Oct 06, 2023 at 05:59:48PM +0900, Masami Hiramatsu wrote: > > > On Thu, 5 Oct 2023 10:17:46 -0700 > > > "Paul E. McKenney" <paulmck@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) <mhiramat@kernel.org> > > > > > > Thank you! > > > > And thank you! I take this as meaning that I should push these three > > commits for the upcoming v6.7 merge window. Please let me know if I > > should be doing something else. > > I have my bootconfig branch, so I think I should pick this and push it > to the next window. Does it work? That works for me, and thank you! (And thank you for taking and fixing my whitespace errors in the other two patches!) Thanx, Paul > > > > 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: 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> > > > > --- > > > > 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) <mhiramat@kernel.org> > > > -- > Masami Hiramatsu (Google) <mhiramat@kernel.org> ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-10-07 3:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <6ea609a4-12e3-4266-8816-b9fca1f1f21c@paulmck-laptop>
2023-10-05 17:17 ` [PATCH bootconfig 2/3] fs/proc: Add boot loader arguments as comment to /proc/bootconfig Paul E. McKenney
2023-10-06 8:59 ` Masami Hiramatsu
2023-10-06 16:52 ` Paul E. McKenney
2023-10-07 1:42 ` Masami Hiramatsu
2023-10-07 3:42 ` Paul E. McKenney
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox