All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: setup.c : boot loader kernel arguments are secured over cmdline.txt arguments for some systems
@ 2017-02-11 19:30 Kishore Karanala
  2017-02-11 20:06 ` Thomas Gleixner
  2017-02-11 20:23 ` kbuild test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Kishore Karanala @ 2017-02-11 19:30 UTC (permalink / raw)
  To: glx, mingo, hpa, x86, linux-kernel, matt, rafael.j.wysocki,
	thgarnie, arbab, dave.hansen
  Cc: kishore.karanala

boot loader kernel arguments are secured over cmdline.txt
arguments for some systems

Signed-off-by: Kishore Karanala <kishore.karanala@gmail.com>
---
 arch/x86/Kconfig        | 3 +++
 arch/x86/kernel/setup.c | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index e487493..3077fb0 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2224,6 +2224,9 @@ config CMDLINE
 	  In most cases, the command line (whether built-in or provided
 	  by the boot loader) should specify the device for the root
 	  file system.
+	 In some of the systems boot loader arguments needs dominated over
+	 cmdline arguments in systems like automotive , this can be done using
+	 CMDLINE="!root=/dev/mmcblk0p1 ro"
 
 config CMDLINE_OVERRIDE
 	bool "Built-in command line overrides boot loader arguments"
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 4cfba94..5fa3194 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -962,11 +962,16 @@ void __init setup_arch(char **cmdline_p)
 #ifdef CONFIG_CMDLINE_OVERRIDE
 	strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
 #else
-	if (builtin_cmdline[0]) {
+	if (builtin_cmdline[0] != '!') {
 		/* append boot loader cmdline to builtin */
 		strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE);
 		strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE);
 		strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
+	} else {
+		/* This will provide additional secuirty to cmdline */
+		/* arguments not overriding bootloader arguments */
+		strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
+		strlcat(boot_command_line, &builtin_cmdline[1], COMMAND_LINE_SIZE);
 	}
 #endif
 #endif
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Staging: setup.c : boot loader kernel arguments are secured over cmdline.txt arguments for some systems
  2017-02-11 19:30 [PATCH] Staging: setup.c : boot loader kernel arguments are secured over cmdline.txt arguments for some systems Kishore Karanala
@ 2017-02-11 20:06 ` Thomas Gleixner
  2017-02-11 20:23 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Gleixner @ 2017-02-11 20:06 UTC (permalink / raw)
  To: Kishore Karanala
  Cc: tglx, mingo, H. Peter Anvin, x86, LKML, matt, rafael.j.wysocki,
	thgarnie, arbab, dave.hansen

On Sun, 12 Feb 2017, Kishore Karanala wrote:
1;2802;0c
The proper subsystem for x86 is x86 and not staging.

Also your subject line is a way too long sentence instead of a short and
precise summary of the change.

> boot loader kernel arguments are secured over cmdline.txt
> arguments for some systems

Repeating it does not make it any better.

What's missing here is an explanation WHY this changes is needed and which
problem it solves.

> Signed-off-by: Kishore Karanala <kishore.karanala@gmail.com>
> ---
>  arch/x86/Kconfig        | 3 +++
>  arch/x86/kernel/setup.c | 7 ++++++-
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index e487493..3077fb0 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -2224,6 +2224,9 @@ config CMDLINE
>  	  In most cases, the command line (whether built-in or provided
>  	  by the boot loader) should specify the device for the root
>  	  file system.
> +	 In some of the systems boot loader arguments needs dominated over
> +	 cmdline arguments in systems like automotive , this can be done using
> +	 CMDLINE="!root=/dev/mmcblk0p1 ro"

I really have no idea what that sentence means. Also it does not explain
what the exclamation mark stands for.

Aside of that the indentation of that paragraph is wrong.

>  config CMDLINE_OVERRIDE
>  	bool "Built-in command line overrides boot loader arguments"
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 4cfba94..5fa3194 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -962,11 +962,16 @@ void __init setup_arch(char **cmdline_p)
>  #ifdef CONFIG_CMDLINE_OVERRIDE
>  	strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
>  #else
> -	if (builtin_cmdline[0]) {
> +	if (builtin_cmdline[0] != '!') {
>  		/* append boot loader cmdline to builtin */
>  		strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE);
>  		strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE);
>  		strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
> +	} else {
> +		/* This will provide additional secuirty to cmdline */

I assume you mean security. What has this to do with security? The empty
changelog does not explain it neither does this comment.

> +		/* arguments not overriding bootloader arguments */

Multiline comments are formatted like this

		/*
		 * This is the first line of a multiline comment which
		 * continues on the second line.
		 */

> +		strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
> +		strlcat(boot_command_line, &builtin_cmdline[1], COMMAND_LINE_SIZE);

So this is just the reverse order of the exsiting mechanism. What's the
point of this exercise?

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Staging: setup.c : boot loader kernel arguments are secured over cmdline.txt arguments for some systems
  2017-02-11 19:30 [PATCH] Staging: setup.c : boot loader kernel arguments are secured over cmdline.txt arguments for some systems Kishore Karanala
  2017-02-11 20:06 ` Thomas Gleixner
@ 2017-02-11 20:23 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2017-02-11 20:23 UTC (permalink / raw)
  To: Kishore Karanala
  Cc: kbuild-all, glx, mingo, hpa, x86, linux-kernel, matt,
	rafael.j.wysocki, thgarnie, arbab, dave.hansen, kishore.karanala

Hi Kishore,

[auto build test ERROR on tip/x86/core]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Kishore-Karanala/Staging-setup-c-boot-loader-kernel-arguments-are-secured-over-cmdline-txt-arguments-for-some-systems/20170212-033448
config: x86_64-randconfig-x008-201707
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        make ARCH=x86_64  randconfig
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

>> arch/x86/Kconfig:2199: syntax error
>> arch/x86/Kconfig:2198: unknown option "In"
   arch/x86/Kconfig:2199:warning: ignoring unsupported character ','
>> arch/x86/Kconfig:2199: unknown option "cmdline"
>> arch/x86/Kconfig:2200: unknown option "CMDLINE"
   make[2]: *** [oldconfig] Error 1
   make[1]: *** [oldconfig] Error 2
   make: *** [sub-make] Error 2
--
>> arch/x86/Kconfig:2199: syntax error
>> arch/x86/Kconfig:2198: unknown option "In"
   arch/x86/Kconfig:2199:warning: ignoring unsupported character ','
>> arch/x86/Kconfig:2199: unknown option "cmdline"
>> arch/x86/Kconfig:2200: unknown option "CMDLINE"
   make[2]: *** [olddefconfig] Error 1
   make[2]: Target 'oldnoconfig' not remade because of errors.
   make[1]: *** [oldnoconfig] Error 2
   make: *** [sub-make] Error 2

vim +2199 arch/x86/Kconfig

  2192		  However, you can use the CONFIG_CMDLINE_OVERRIDE option to
  2193		  change this behavior.
  2194	
  2195		  In most cases, the command line (whether built-in or provided
  2196		  by the boot loader) should specify the device for the root
  2197		  file system.
> 2198		 In some of the systems boot loader arguments needs dominated over
> 2199		 cmdline arguments in systems like automotive , this can be done using
> 2200		 CMDLINE="!root=/dev/mmcblk0p1 ro"
  2201	
  2202	config CMDLINE_OVERRIDE
  2203		bool "Built-in command line overrides boot loader arguments"

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-11 20:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-11 19:30 [PATCH] Staging: setup.c : boot loader kernel arguments are secured over cmdline.txt arguments for some systems Kishore Karanala
2017-02-11 20:06 ` Thomas Gleixner
2017-02-11 20:23 ` kbuild test robot

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.