Commit d6580a9f authored by Neil Horman's avatar Neil Horman Committed by Linus Torvalds
Browse files

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).

[ build fix]
Signed-off-by: default avatarNeil Horman <>
Acked-by: default avatarVivek Goyal <>
Cc: Brayan Arraes <>
Cc: "Eric W. Biederman" <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent c8a06c1e
......@@ -121,20 +121,17 @@ static struct sysrq_key_op sysrq_unraw_op = {
#define sysrq_unraw_op (*(struct sysrq_key_op *)0)
#endif /* CONFIG_VT */
static void sysrq_handle_crashdump(int key, struct tty_struct *tty)
static void sysrq_handle_crash(int key, struct tty_struct *tty)
char *killer = NULL;
*killer = 1;
static struct sysrq_key_op sysrq_crashdump_op = {
.handler = sysrq_handle_crashdump,
.help_msg = "Crashdump",
.action_msg = "Trigger a crashdump",
.handler = sysrq_handle_crash,
.help_msg = "Crash",
.action_msg = "Trigger a crash",
.enable_mask = SYSRQ_ENABLE_DUMP,
#define sysrq_crashdump_op (*(struct sysrq_key_op *)0)
static void sysrq_handle_reboot(int key, struct tty_struct *tty)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment