Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1579091 > unrolled thread

[PATCH] Staging: setup.c : boot loader kernel arguments are secured over cmdline.txt arguments for some systems

Started byKishore Karanala <kishore.karanala@gmail.com>
First post2017-02-11 20:40 +0100
Last post2017-02-11 21:30 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] Staging: setup.c : boot loader kernel arguments are secured over cmdline.txt arguments for some systems Kishore Karanala <kishore.karanala@gmail.com> - 2017-02-11 20:40 +0100
    Re: [PATCH] Staging: setup.c : boot loader kernel arguments are  secured over cmdline.txt arguments for some systems Thomas Gleixner <tglx@linutronix.de> - 2017-02-11 21:10 +0100
    Re: [PATCH] Staging: setup.c : boot loader kernel arguments are  secured over cmdline.txt arguments for some systems kbuild test robot <lkp@intel.com> - 2017-02-11 21:30 +0100

#1579091 — [PATCH] Staging: setup.c : boot loader kernel arguments are secured over cmdline.txt arguments for some systems

FromKishore Karanala <kishore.karanala@gmail.com>
Date2017-02-11 20:40 +0100
Subject[PATCH] Staging: setup.c : boot loader kernel arguments are secured over cmdline.txt arguments for some systems
Message-ID<t9LGy-4H8-13@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1579094 — Re: [PATCH] Staging: setup.c : boot loader kernel arguments are secured over cmdline.txt arguments for some systems

FromThomas Gleixner <tglx@linutronix.de>
Date2017-02-11 21:10 +0100
SubjectRe: [PATCH] Staging: setup.c : boot loader kernel arguments are secured over cmdline.txt arguments for some systems
Message-ID<t9M9z-56y-3@gated-at.bofh.it>
In reply to#1579091
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

[toc] | [prev] | [next] | [standalone]


#1579101 — Re: [PATCH] Staging: setup.c : boot loader kernel arguments are secured over cmdline.txt arguments for some systems

Fromkbuild test robot <lkp@intel.com>
Date2017-02-11 21:30 +0100
SubjectRe: [PATCH] Staging: setup.c : boot loader kernel arguments are secured over cmdline.txt arguments for some systems
Message-ID<t9MsW-5dv-13@gated-at.bofh.it>
In reply to#1579091
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web