linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Tom Zanussi <zanussi@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [GIT PULL] tracing: Changes for 5.6
Date: Tue, 4 Feb 2020 07:28:56 -0500	[thread overview]
Message-ID: <20200204072856.0da60613@oasis.local.home> (raw)
In-Reply-To: <CAHk-=wjfjO+h6bQzrTf=YCZA53Y3EDyAs3Z4gEsT7icA3u_Psw@mail.gmail.com>

On Tue, 4 Feb 2020 11:54:09 +0000
Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Tue, Feb 4, 2020 at 10:32 AM Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> >  - Added new "bootconfig".
> >    Looks for a file appended to initrd to add boot config options.
> >    This has been discussed thoroughly at Linux Plumbers.
> >    Very useful for adding kprobes at bootup.  
> 
> Is there a way to disable this from the "real" kernel command line?

Currently no.

> 
> If I have problems, I want to boot with a known kernel command line
> (forcing text mode etc). If the bootconfig file always gets parsed,
> there's no way to do that from the bootloader (grub2, whatever)..
> 

I totally agree as I had that exact same issue while testing this. I
wanted to not have it and found it a bit annoying I needed to modify
the initrd to remove it for just a single boot up.

Would this work?

-- Steve

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index ade4e6ec23e0..c4f1417f1934 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -857,6 +857,10 @@
                 on      Perform hardened usercopy checks (default).
                 off     Disable hardened usercopy checks.
 
+	disable_bootconfig
+			Disable reading the bootconfig that may be attached
+			to the initrd.
+
 	disable_radix	[PPC]
 			Disable RADIX MMU mode on POWER9
 
diff --git a/init/main.c b/init/main.c
index dd7da62d99a5..b52636cd9c1d 100644
--- a/init/main.c
+++ b/init/main.c
@@ -336,15 +336,23 @@ u32 boot_config_checksum(unsigned char *p, u32 size)
 	return ret;
 }
 
-static void __init setup_boot_config(void)
+static void __init setup_boot_config(const char *cmdline)
 {
 	u32 size, csum;
 	char *data, *copy;
+	const char *p;
 	u32 *hdr;
 
 	if (!initrd_end)
 		return;
 
+	p = strstr(cmdline, "disable_bootconfig");
+	if (p && (p == cmdline || isspace(*(p-1))) &&
+	    (!p[18] || isspace(p[18]))) {
+		pr_info("Disabling bootconfig because 'disable_bootconfig' found on the command line\n");
+		return;
+	}
+
 	hdr = (u32 *)(initrd_end - 8);
 	size = hdr[0];
 	csum = hdr[1];
@@ -379,7 +387,7 @@ static void __init setup_boot_config(void)
 	}
 }
 #else
-#define setup_boot_config()	do { } while (0)
+#define setup_boot_config(cmdline)	do { } while (0)
 #endif
 
 /* Change NUL term back to "=", to make "param" the whole string. */
@@ -760,7 +768,7 @@ asmlinkage __visible void __init start_kernel(void)
 	pr_notice("%s", linux_banner);
 	early_security_init();
 	setup_arch(&command_line);
-	setup_boot_config();
+	setup_boot_config(command_line);
 	setup_command_line(command_line);
 	setup_nr_cpu_ids();
 	setup_per_cpu_areas();

  reply	other threads:[~2020-02-04 12:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04 10:31 [GIT PULL] tracing: Changes for 5.6 Steven Rostedt
2020-02-04 11:54 ` Linus Torvalds
2020-02-04 12:28   ` Steven Rostedt [this message]
2020-02-04 12:43     ` [PATCH] bootconfig: Add "disable_bootconfig" cmdline option to disable bootconfig Steven Rostedt
2020-02-04 13:19     ` [GIT PULL] tracing: Changes for 5.6 Linus Torvalds
2020-02-04 13:46       ` Steven Rostedt
2020-02-04 14:25         ` [PATCH v2] bootconfig: Only load bootconfig if "config=bootconfig" is on the kernel cmdline (was: bootconfig: Add "disable_bootconfig" cmdline option to disable bootconfig) Steven Rostedt
2020-02-04 14:33           ` Steven Rostedt
2020-02-04 15:43             ` Linus Torvalds

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=20200204072856.0da60613@oasis.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.org \
    --cc=zanussi@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;
as well as URLs for NNTP newsgroup(s).