From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751106AbdBKTaX (ORCPT ); Sat, 11 Feb 2017 14:30:23 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33966 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750999AbdBKTaV (ORCPT ); Sat, 11 Feb 2017 14:30:21 -0500 From: Kishore Karanala To: glx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org, matt@codeblueprint.co.uk, rafael.j.wysocki@intel.com, thgarnie@google.com, arbab@linux.vnet.ibm.com, dave.hansen@linux.intel.com Cc: kishore.karanala@gmail.com Subject: [PATCH] Staging: setup.c : boot loader kernel arguments are secured over cmdline.txt arguments for some systems Date: Sun, 12 Feb 2017 01:00:00 +0530 Message-Id: <1486841400-5063-1-git-send-email-kishore.karanala@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org boot loader kernel arguments are secured over cmdline.txt arguments for some systems Signed-off-by: Kishore Karanala --- 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