Skip to contentSkip to conversation

init: Make unknown command line param message clearer

PATCH Applied Andrew Halaney 3 participants 4 messages Oct 13, 2021 – Oct 14, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 init: Make unknown command line param message clearer

The prior message is confusing users, which is the exact opposite of the goal. If the message is being seen, one of the following situations is happening:

1. the param is misspelled
2. the param is not valid due to the kernel configuration
3. the param is intended for init but isn't after the '--' delineator on the command line

To make that more clear to the user, explicitly mention "kernel command line" and also note that the params are still passed to user space to avoid causing any alarm over params intended for init.

Fixes 86d1919a4fb0 ("init: print out unknown kernel parameters")

---

Here's v2 of this. I had to change the code a bit from what Steven recommended to compile/look proper, but the intended format he had suggested is still the same.

v1 -> v2:
* Print a much more concise message

v1: https://lore.kernel.org/all/[email protected]/

Thanks,
Andrew

 init/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
init/main.c +3 -1
index ee4d3e1b3eb9..a286995449e2 100644
@@ -925,7 +925,9 @@ static void __init print_unknown_bootoptions(void)
 	for (p = &envp_init[2]; *p; p++)
 		end += sprintf(end, " %s", *p);
 
-	pr_notice("Unknown command line parameters:%s\n", unknown_options);
+	/* Start at unknown_options[1] to skip the initial space */
+	pr_notice("Unknown kernel command line parameters \"%s\", will be passed to user space.\n",
+		&unknown_options[1]);
 	memblock_free(unknown_options, len);
 }
 
Signature · 1 line
2.31.1
Acked-by on v1 1/1
#1 lore raw
Quoted 39 lines · Andrew Halaney

The prior message is confusing users, which is the exact opposite of the goal. If the message is being seen, one of the following situations is happening:

1. the param is misspelled
2. the param is not valid due to the kernel configuration
3. the param is intended for init but isn't after the '--' delineator on the command line

To make that more clear to the user, explicitly mention "kernel command line" and also note that the params are still passed to user space to avoid causing any alarm over params intended for init.

Fixes 86d1919a4fb0 ("init: print out unknown kernel parameters")

---

Here's v2 of this. I had to change the code a bit from what Steven recommended to compile/look proper, but the intended format he had suggested is still the same.

v1 -> v2:
* Print a much more concise message

v1: https://lore.kernel.org/all/[email protected]/

Thanks,
Andrew

  init/main.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
init/main.c +0 -0
index ee4d3e1b3eb9..a286995449e2 100644

init/main.c static void __init print_unknown_bootoptions(void) · line 933

Quoted 10 lines
init/main.c +3 -1
@@ -925,7 +925,9 @@ static void __init print_unknown_bootoptions(void)
  	for (p = &envp_init[2]; *p; p++)
  		end += sprintf(end, " %s", *p);
 
-	pr_notice("Unknown command line parameters:%s\n", unknown_options);
+	/* Start at unknown_options[1] to skip the initial space */
+	pr_notice("Unknown kernel command line parameters \"%s\", will be passed to user space.\n",
+		&unknown_options[1]);
  	memblock_free(unknown_options, len);
  }
 

LGTM. Thanks.

Signature · 1 line
~Randy
#2 lore raw
In reply to Andrew Halaney
Quoted 9 lines · On Wed, 13 Oct 2021 17:35:02 -0500 Andrew Halaney <[email protected]> wrote:

The prior message is confusing users, which is the exact opposite of the goal. If the message is being seen, one of the following situations is happening:

1. the param is misspelled
2. the param is not valid due to the kernel configuration
3. the param is intended for init but isn't after the '--' delineator on the command line

Quoted 7 lines

To make that more clear to the user, explicitly mention "kernel command line" and also note that the params are still passed to user space to avoid causing any alarm over params intended for init.

Fixes 86d1919a4fb0 ("init: print out unknown kernel parameters")

Thanks.

BTW, I'm still sitting on your "init/main.c: silence some -Wunused-parameter warnings", awaiting a response to Rasmus's suggestion:
https://lkml.kernel.org/r/[email protected]

#3 lore raw
Quoted 19 lines · Andrew Morton
Quoted 9 lines · On Wed, 13 Oct 2021 17:35:02 -0500 Andrew Halaney <[email protected]> wrote:

The prior message is confusing users, which is the exact opposite of the goal. If the message is being seen, one of the following situations is happening:

1. the param is misspelled
2. the param is not valid due to the kernel configuration
3. the param is intended for init but isn't after the '--' delineator on the command line

Quoted 7 lines

To make that more clear to the user, explicitly mention "kernel command line" and also note that the params are still passed to user space to avoid causing any alarm over params intended for init.

Fixes 86d1919a4fb0 ("init: print out unknown kernel parameters")
Quoted 7 lines

Thanks.

BTW, I'm still sitting on your "init/main.c: silence some -Wunused-parameter warnings", awaiting a response to Rasmus's suggestion:
https://lkml.kernel.org/r/[email protected]

Whoops, that got caught in spam (along with rostedt's replies yesterday... darn gmail). Let me add looking at that to the todo list, thanks Andrew!