* [PATCH] init: Suppress wrong warning for bootconfig cmdline parameter
@ 2021-08-05 2:10 Masami Hiramatsu
2021-08-05 15:22 ` Andrew Halaney
0 siblings, 1 reply; 4+ messages in thread
From: Masami Hiramatsu @ 2021-08-05 2:10 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-kernel, Andrew Halaney, Masami Hiramatsu, Borislav Petkov
Since the 'bootconfig' command line parameter is handled before
parsing the command line, it doesn't use early_param(). But in
this case, kernel shows a wrong warning message about it.
[ 0.013714] Kernel command line: ro console=ttyS0 bootconfig console=tty0
[ 0.013741] Unknown command line parameters: bootconfig
To suppress this message, add a dummy handler for 'bootconfig'.
Fixes: 86d1919a4fb0 ("init: print out unknown kernel parameters")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
init/main.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/init/main.c b/init/main.c
index f5b8246e8aa1..8d97aba78c3a 100644
--- a/init/main.c
+++ b/init/main.c
@@ -397,6 +397,12 @@ static int __init bootconfig_params(char *param, char *val,
return 0;
}
+static int __init warn_bootconfig(char *str)
+{
+ /* The 'bootconfig' has been handled by bootconfig_params(). */
+ return 0;
+}
+
static void __init setup_boot_config(void)
{
static char tmp_cmdline[COMMAND_LINE_SIZE] __initdata;
@@ -475,9 +481,8 @@ static int __init warn_bootconfig(char *str)
pr_warn("WARNING: 'bootconfig' found on the kernel command line but CONFIG_BOOT_CONFIG is not set.\n");
return 0;
}
-early_param("bootconfig", warn_bootconfig);
-
#endif
+early_param("bootconfig", warn_bootconfig);
/* Change NUL term back to "=", to make "param" the whole string. */
static void __init repair_env_string(char *param, char *val)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] init: Suppress wrong warning for bootconfig cmdline parameter
2021-08-05 2:10 [PATCH] init: Suppress wrong warning for bootconfig cmdline parameter Masami Hiramatsu
@ 2021-08-05 15:22 ` Andrew Halaney
2021-08-06 13:49 ` Masami Hiramatsu
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Halaney @ 2021-08-05 15:22 UTC (permalink / raw)
To: Masami Hiramatsu; +Cc: Steven Rostedt, linux-kernel, Borislav Petkov
On Thu, Aug 05, 2021 at 11:10:51AM +0900, Masami Hiramatsu wrote:
> Since the 'bootconfig' command line parameter is handled before
> parsing the command line, it doesn't use early_param(). But in
> this case, kernel shows a wrong warning message about it.
>
> [ 0.013714] Kernel command line: ro console=ttyS0 bootconfig console=tty0
> [ 0.013741] Unknown command line parameters: bootconfig
>
> To suppress this message, add a dummy handler for 'bootconfig'.
>
> Fixes: 86d1919a4fb0 ("init: print out unknown kernel parameters")
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> ---
> init/main.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/init/main.c b/init/main.c
> index f5b8246e8aa1..8d97aba78c3a 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -397,6 +397,12 @@ static int __init bootconfig_params(char *param, char *val,
> return 0;
> }
>
> +static int __init warn_bootconfig(char *str)
> +{
> + /* The 'bootconfig' has been handled by bootconfig_params(). */
> + return 0;
> +}
> +
> static void __init setup_boot_config(void)
> {
> static char tmp_cmdline[COMMAND_LINE_SIZE] __initdata;
> @@ -475,9 +481,8 @@ static int __init warn_bootconfig(char *str)
> pr_warn("WARNING: 'bootconfig' found on the kernel command line but CONFIG_BOOT_CONFIG is not set.\n");
> return 0;
> }
> -early_param("bootconfig", warn_bootconfig);
> -
> #endif
> +early_param("bootconfig", warn_bootconfig);
>
> /* Change NUL term back to "=", to make "param" the whole string. */
> static void __init repair_env_string(char *param, char *val)
>
Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Thanks Masami, this is one of the corner case command line parameters
that I was trying to highlight when I made the original commit (but I
didn't catch this one).
I _think_ the only other one is dyndbg based on some grepping. I'm
debating if it makes sense to do something similar there or to actually
use a callback to do some of the work it needs in stealing from the CLI.
For this case though I don't see how you could do anything other than
what you've done here -- you can't modify the params once we've started
processing, and that's what bootconfig needs to do.
Thanks,
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] init: Suppress wrong warning for bootconfig cmdline parameter
2021-08-05 15:22 ` Andrew Halaney
@ 2021-08-06 13:49 ` Masami Hiramatsu
2021-08-06 14:08 ` Masami Hiramatsu
0 siblings, 1 reply; 4+ messages in thread
From: Masami Hiramatsu @ 2021-08-06 13:49 UTC (permalink / raw)
To: Andrew Halaney; +Cc: Steven Rostedt, linux-kernel, Borislav Petkov
Hi Andrew,
On Thu, 5 Aug 2021 10:22:21 -0500
Andrew Halaney <ahalaney@redhat.com> wrote:
> On Thu, Aug 05, 2021 at 11:10:51AM +0900, Masami Hiramatsu wrote:
> > Since the 'bootconfig' command line parameter is handled before
> > parsing the command line, it doesn't use early_param(). But in
> > this case, kernel shows a wrong warning message about it.
> >
> > [ 0.013714] Kernel command line: ro console=ttyS0 bootconfig console=tty0
> > [ 0.013741] Unknown command line parameters: bootconfig
> >
> > To suppress this message, add a dummy handler for 'bootconfig'.
> >
> > Fixes: 86d1919a4fb0 ("init: print out unknown kernel parameters")
> > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > ---
> > init/main.c | 9 +++++++--
> > 1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/init/main.c b/init/main.c
> > index f5b8246e8aa1..8d97aba78c3a 100644
> > --- a/init/main.c
> > +++ b/init/main.c
> > @@ -397,6 +397,12 @@ static int __init bootconfig_params(char *param, char *val,
> > return 0;
> > }
> >
> > +static int __init warn_bootconfig(char *str)
> > +{
> > + /* The 'bootconfig' has been handled by bootconfig_params(). */
> > + return 0;
> > +}
> > +
> > static void __init setup_boot_config(void)
> > {
> > static char tmp_cmdline[COMMAND_LINE_SIZE] __initdata;
> > @@ -475,9 +481,8 @@ static int __init warn_bootconfig(char *str)
> > pr_warn("WARNING: 'bootconfig' found on the kernel command line but CONFIG_BOOT_CONFIG is not set.\n");
> > return 0;
> > }
> > -early_param("bootconfig", warn_bootconfig);
> > -
> > #endif
> > +early_param("bootconfig", warn_bootconfig);
> >
> > /* Change NUL term back to "=", to make "param" the whole string. */
> > static void __init repair_env_string(char *param, char *val)
> >
>
> Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
>
> Thanks Masami, this is one of the corner case command line parameters
> that I was trying to highlight when I made the original commit (but I
> didn't catch this one).
But if there are other parameters which also depends on kconfig?
This actually depends on CONFIG_BOOT_CONFIG=y. I guess there are
other parameters which are also depends on kconfig.
(and usually, developers doesn't change their grub.conf when he install
a new kernel)
>
> I _think_ the only other one is dyndbg based on some grepping. I'm
> debating if it makes sense to do something similar there or to actually
> use a callback to do some of the work it needs in stealing from the CLI.
>
> For this case though I don't see how you could do anything other than
> what you've done here -- you can't modify the params once we've started
> processing, and that's what bootconfig needs to do.
Actually, if CONFIG_BOOT_CONFIG=y, "bootconfig" is handled before preparing
cmdline strings, because it will copy (append) additional cmdline args
from the bootconfig to the cmdline.
I can remove the "bootconfig" string too. But I think it is better to keep
it in the cmdline so that users can ensure what he passed to the kernel.
Thank you,
--
Masami Hiramatsu <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] init: Suppress wrong warning for bootconfig cmdline parameter
2021-08-06 13:49 ` Masami Hiramatsu
@ 2021-08-06 14:08 ` Masami Hiramatsu
0 siblings, 0 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2021-08-06 14:08 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Andrew Halaney, Steven Rostedt, linux-kernel, Borislav Petkov
On Fri, 6 Aug 2021 22:49:41 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:
> Hi Andrew,
>
> On Thu, 5 Aug 2021 10:22:21 -0500
> Andrew Halaney <ahalaney@redhat.com> wrote:
>
> > On Thu, Aug 05, 2021 at 11:10:51AM +0900, Masami Hiramatsu wrote:
> > > Since the 'bootconfig' command line parameter is handled before
> > > parsing the command line, it doesn't use early_param(). But in
> > > this case, kernel shows a wrong warning message about it.
> > >
> > > [ 0.013714] Kernel command line: ro console=ttyS0 bootconfig console=tty0
> > > [ 0.013741] Unknown command line parameters: bootconfig
> > >
> > > To suppress this message, add a dummy handler for 'bootconfig'.
> > >
> > > Fixes: 86d1919a4fb0 ("init: print out unknown kernel parameters")
> > > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > > ---
> > > init/main.c | 9 +++++++--
> > > 1 file changed, 7 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/init/main.c b/init/main.c
> > > index f5b8246e8aa1..8d97aba78c3a 100644
> > > --- a/init/main.c
> > > +++ b/init/main.c
> > > @@ -397,6 +397,12 @@ static int __init bootconfig_params(char *param, char *val,
> > > return 0;
> > > }
> > >
> > > +static int __init warn_bootconfig(char *str)
> > > +{
> > > + /* The 'bootconfig' has been handled by bootconfig_params(). */
> > > + return 0;
> > > +}
> > > +
> > > static void __init setup_boot_config(void)
> > > {
> > > static char tmp_cmdline[COMMAND_LINE_SIZE] __initdata;
> > > @@ -475,9 +481,8 @@ static int __init warn_bootconfig(char *str)
> > > pr_warn("WARNING: 'bootconfig' found on the kernel command line but CONFIG_BOOT_CONFIG is not set.\n");
> > > return 0;
> > > }
> > > -early_param("bootconfig", warn_bootconfig);
> > > -
> > > #endif
> > > +early_param("bootconfig", warn_bootconfig);
> > >
> > > /* Change NUL term back to "=", to make "param" the whole string. */
> > > static void __init repair_env_string(char *param, char *val)
> > >
> >
> > Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
> >
> > Thanks Masami, this is one of the corner case command line parameters
> > that I was trying to highlight when I made the original commit (but I
> > didn't catch this one).
>
> But if there are other parameters which also depends on kconfig?
> This actually depends on CONFIG_BOOT_CONFIG=y. I guess there are
> other parameters which are also depends on kconfig.
> (and usually, developers doesn't change their grub.conf when he install
> a new kernel)
Ah, sorry. I misunderstood. With your patch, the kernel can notice that
the kernel may not be correctly configured too.
Thank you!
--
Masami Hiramatsu <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-08-06 14:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05 2:10 [PATCH] init: Suppress wrong warning for bootconfig cmdline parameter Masami Hiramatsu
2021-08-05 15:22 ` Andrew Halaney
2021-08-06 13:49 ` Masami Hiramatsu
2021-08-06 14:08 ` Masami Hiramatsu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.