Staging: setup.c : boot loader kernel arguments are secured over cmdline.txt arguments for some systems
PATCH 1/1 Staging: setup.c : boot loader kernel arguments are secured over cmdline.txt arguments for some systems
boot loader kernel arguments are secured over cmdline.txt arguments for some systems
--- arch/x86/Kconfig | 3 +++ arch/x86/kernel/setup.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-)
arch/x86/Kconfig +3 -0
@@ -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"
arch/x86/kernel/setup.c +6 -1
@@ -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
Signature · 1 line
2.7.4
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.
Quoted 2 lines
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.
Quoted 11 lines
Signed-off-by Kishore Karanala <[email protected]>--- arch/x86/Kconfig | 3 +++ arch/x86/kernel/setup.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-)arch/x86/Kconfig +0
-0
arch/x86/Kconfig config CMDLINE · line 2229
Quoted 6 lines
arch/x86/Kconfig +3
-0@@ -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.
Quoted 8 lines
arch/x86/Kconfig +0
-0config CMDLINE_OVERRIDE bool "Built-in command line overrides boot loader arguments"arch/x86/kernel/setup.c +0
-0@@ -962,11 +962,16 @@ void __init setup_arch(char **cmdline_p)#ifdef CONFIG_CMDLINE_OVERRIDE
arch/x86/kernel/setup.c void __init setup_arch(char **cmdline_p) · line 971
Quoted 10 lines
arch/x86/kernel/setup.c +3
-1strlcpy (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.
arch/x86/kernel/setup.c void __init setup_arch(char **cmdline_p) · line 972
Quoted 1 line
arch/x86/kernel/setup.c +1
-0+/* 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. */
arch/x86/kernel/setup.c void __init setup_arch(char **cmdline_p) · line 974
Quoted 2 lines
arch/x86/kernel/setup.c +2
-0+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
kbuild test robot
build boturl: 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…
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