mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kishore Karanala <kishore.karanala@gmail.com>
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	[thread overview]
Message-ID: <1486841400-5063-1-git-send-email-kishore.karanala@gmail.com> (raw)

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

             reply	other threads:[~2017-02-11 19:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-11 19:30 Kishore Karanala [this message]
2017-02-11 20:06 ` Thomas Gleixner
2017-02-11 20:23 ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1486841400-5063-1-git-send-email-kishore.karanala@gmail.com \
    --to=kishore.karanala@gmail.com \
    --cc=arbab@linux.vnet.ibm.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=glx@linutronix.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeblueprint.co.uk \
    --cc=mingo@redhat.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=thgarnie@google.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®