From: Werner Almesberger <werner@almesberger.net>
To: linux-kernel@vger.kernel.org
Subject: [patch] defer panic for too many items in boot parameter line
Date: Sun, 8 Feb 2004 19:07:32 -0300 [thread overview]
Message-ID: <20040208190732.H1325@almesberger.net> (raw)
When passing too many unrecognized boot command line options (which
become arguments or environment variables), the 2.6 kernel panics
(unlike 2.4, which just ignores the extra items). Unfortunately,
this happens before the console is initialized, so all you get is a
kernel that dies quickly, for no apparent reason.
This is particularly irritating if using UML with
init=something wi th a lot of ar gu men t s
The patch below delays the panic until after console_init.
It's for 2.6.2 and also works for 2.6.1. Tested on i386 and um.
- Werner
--- linux-2.6.2/init/main.c.orig 2004-02-08 17:13:20.000000000 -0300
+++ linux-2.6.2/init/main.c 2004-02-08 18:06:49.000000000 -0300
@@ -141,6 +141,7 @@
static char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };
+static const char *panic_later, *panic_param;
__setup("profile=", profile_setup);
@@ -253,20 +254,27 @@
return 0;
}
+ if (panic_later)
+ return 0;
+
if (val) {
/* Environment option */
unsigned int i;
for (i = 0; envp_init[i]; i++) {
- if (i == MAX_INIT_ENVS)
- panic("Too many boot env vars at `%s'", param);
+ if (i == MAX_INIT_ENVS) {
+ panic_later = "Too many boot env vars at `%s'";
+ panic_param = param;
+ }
}
envp_init[i] = param;
} else {
/* Command line option */
unsigned int i;
for (i = 0; argv_init[i]; i++) {
- if (i == MAX_INIT_ARGS)
- panic("Too many boot init vars at `%s'",param);
+ if (i == MAX_INIT_ARGS) {
+ panic_later = "Too many boot init vars at `%s'";
+ panic_param = param;
+ }
}
argv_init[i] = param;
}
@@ -424,6 +432,8 @@
* this. But we do want output early, in case something goes wrong.
*/
console_init();
+ if (panic_later)
+ panic(panic_later, panic_param);
profile_init();
local_irq_enable();
#ifdef CONFIG_BLK_DEV_INITRD
--
_________________________________________________________________________
/ Werner Almesberger, Buenos Aires, Argentina werner@almesberger.net /
/_http://www.almesberger.net/____________________________________________/
next reply other threads:[~2004-02-08 22:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-08 22:07 Werner Almesberger [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-02-08 22:23 [patch] defer panic for too many items in boot parameter line Michael Frank
2004-02-09 0:38 ` Werner Almesberger
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=20040208190732.H1325@almesberger.net \
--to=werner@almesberger.net \
--cc=linux-kernel@vger.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