Neil Horman | 5 May 2009 15:45
Favicon

[PATCH] 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).

Neil

Signed-off-by: Neil Horman <nhorman@...>

 sysrq.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index b0a6a3e..9319e75 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
 <at>  <at>  -120,20 +120,17  <at>  <at>  static struct sysrq_key_op sysrq_unraw_op = {
 #define sysrq_unraw_op (*(struct sysrq_key_op *)0)
 #endif /* CONFIG_VT */

-#ifdef CONFIG_KEXEC
-static void sysrq_handle_crashdump(int key, struct tty_struct *tty)
+static void sysrq_handle_crash(int key, struct tty_struct *tty)
(Continue reading)

Vivek Goyal | 5 May 2009 16:23
Picon
Favicon

Re: [PATCH] sysrq: Simplify sysrq-c handler

On Tue, May 05, 2009 at 09:45:47AM -0400, Neil Horman wrote:
> 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).
> 

Neil,

Would it make sense to call panic() directly so that we are not dependent
on panic_on_oops being set?

Thanks
Vivek

> Neil
> 
> Signed-off-by: Neil Horman <nhorman@...>
> 
> 
>  sysrq.c |   15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
(Continue reading)

Neil Horman | 5 May 2009 16:49
Picon
Favicon

Re: [PATCH] sysrq: Simplify sysrq-c handler

On Tue, May 05, 2009 at 10:23:59AM -0400, Vivek Goyal wrote:
> On Tue, May 05, 2009 at 09:45:47AM -0400, Neil Horman wrote:
> > 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).
> > 
> 
> Neil,
> 
> Would it make sense to call panic() directly so that we are not dependent
> on panic_on_oops being set?
> 
> Thanks
> Vivek
> 
I think a good argument could be made for doing that, but I kind of like
traversing the entire page fault path, specifically to make sure that an oops
works the way they expect it too.  If nothing else, going through the entire
oops path like I do below will (hopefully) prevent people from complaining that
sysrq-c works, but when their custom module gets an OOPS, then never get a
vmcore :).

(Continue reading)

Vivek Goyal | 5 May 2009 16:53
Picon
Favicon

Re: [PATCH] sysrq: Simplify sysrq-c handler

On Tue, May 05, 2009 at 10:49:37AM -0400, Neil Horman wrote:
> On Tue, May 05, 2009 at 10:23:59AM -0400, Vivek Goyal wrote:
> > On Tue, May 05, 2009 at 09:45:47AM -0400, Neil Horman wrote:
> > > 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).
> > > 
> > 
> > Neil,
> > 
> > Would it make sense to call panic() directly so that we are not dependent
> > on panic_on_oops being set?
> > 
> > Thanks
> > Vivek
> > 
> I think a good argument could be made for doing that, but I kind of like
> traversing the entire page fault path, specifically to make sure that an oops
> works the way they expect it too.  If nothing else, going through the entire
> oops path like I do below will (hopefully) prevent people from complaining that
> sysrq-c works, but when their custom module gets an OOPS, then never get a
> vmcore :).
(Continue reading)

Brayan Arraes | 5 May 2009 17:04
Picon

Re: [PATCH] sysrq: Simplify sysrq-c handler


+1 vote to going through the oops path

-- 
Archlinux User.
Linux User #483990
May the source be with YOU!!!
_______________________________________________
kexec mailing list
kexec@...
http://lists.infradead.org/mailman/listinfo/kexec

Gmane