From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Neil Horman <nhorman@tuxdriver.com>,
Vivek Goyal <vgoyal@redhat.com>,
Brayan Arraes <brayan@yack.com.br>,
"Eric W. Biederman" <ebiederm@xmission.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] sysrq, kdump: fix regression, revert "simplify sysrq-c handler"
Date: Mon, 20 Jul 2009 20:46:38 +0800 [thread overview]
Message-ID: <4A64672E.8020005@cn.fujitsu.com> (raw)
1) This fix breaks our tools.
This fix changes the ABI. panic_on_oops is default 0,
and a lots system do not specify the boot option "panic",
thus, Sysrq-c will not cause CrashDump(Kdump) as expected.
2) When CONFIG_KEXEC=n, Sysrq-c should become an invalid
command like Sysrq-D(CONFIG_LOCKDEP, show-all-locks).
But this fix makes it a valid command and let it do a
hazard thing: cause a page fault(NULL dereference) in kernel.
So, we revert this fix.
|commit d6580a9f15238b87e618310c862231ae3f352d2d
|Author: Neil Horman <nhorman@tuxdriver.com>
|Date: Wed Jun 17 16:28:17 2009 -0700
| kexec: sysrq: simplify sysrq-c handler
| Currently the sysrq-c handler is bit over-engineered. Its behavior is
| dependent on a few compile time and run time factors that alter its
| behavior which is really unnecessecary.
| If CONFIG_KEXEC is not configured, sysrq-c, crashes the system with a NULL
| pointer dereference. If CONFIG_KEXEC is configured, it calls crash_kexec
| directly, which implies that the kexec kernel will either be booted (if
| its been previously loaded), or it will simply do nothing (the no kexec
| kernel has been loaded).
| It would be much easier to just simplify the whole thing to dereference a
| NULL pointer all the time regardless of configuration. That way, it will
| always try to crash the system, and if a kexec kernel has been loaded into
| reserved space, it will still boot from the page fault trap handler
| (assuming panic_on_oops is set appropriately).
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index 0db3585..39a05b5 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -121,17 +121,20 @@ static struct sysrq_key_op sysrq_unraw_op = {
#define sysrq_unraw_op (*(struct sysrq_key_op *)0)
#endif /* CONFIG_VT */
-static void sysrq_handle_crash(int key, struct tty_struct *tty)
+#ifdef CONFIG_KEXEC
+static void sysrq_handle_crashdump(int key, struct tty_struct *tty)
{
- char *killer = NULL;
- *killer = 1;
+ crash_kexec(get_irq_regs());
}
static struct sysrq_key_op sysrq_crashdump_op = {
- .handler = sysrq_handle_crash,
- .help_msg = "Crash",
- .action_msg = "Trigger a crash",
+ .handler = sysrq_handle_crashdump,
+ .help_msg = "Crashdump",
+ .action_msg = "Trigger a crashdump",
.enable_mask = SYSRQ_ENABLE_DUMP,
};
+#else
+#define sysrq_crashdump_op (*(struct sysrq_key_op *)0)
+#endif
static void sysrq_handle_reboot(int key, struct tty_struct *tty)
{
next reply other threads:[~2009-07-20 12:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-20 12:46 Lai Jiangshan [this message]
2009-07-20 19:22 ` [PATCH] sysrq, kdump: fix regression, revert "simplify sysrq-c handler" Eric W. Biederman
2009-07-20 21:16 ` Neil Horman
2009-07-21 6:46 ` Lai Jiangshan
2009-07-21 22:18 ` Eric W. Biederman
2009-07-21 6:00 ` Lai Jiangshan
2009-07-21 6:56 ` Eric W. Biederman
2009-07-21 6:49 ` Hidetoshi Seto
2009-07-21 11:08 ` Neil Horman
2009-07-21 12:16 ` Lai Jiangshan
2009-07-22 2:01 ` Hidetoshi Seto
2009-07-22 11:10 ` Neil Horman
2009-07-22 13:42 ` Vivek Goyal
2009-07-22 19:38 ` Neil Horman
2009-07-23 1:10 ` Hidetoshi Seto
2009-07-23 1:09 ` Hidetoshi Seto
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=4A64672E.8020005@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=brayan@yack.com.br \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=vgoyal@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.