Bernhard Walle wrote:
> Hi Jay,
>
> while testing the fix for my last problem, I found another issue. I
> think the attached patch is the right fix for it, can you please review
> the patch and add it to your patch series in next release?
>
>
> Regards,
> Bernhard
>
Thanks Bernhard, Applied.
- jay

===================================================================================

This patch fixes following problem:

When panic() in user context, for example by

    # modprobe crasher call_panic

then KDB crashed in kdba_getpc() once because regs was not checked for being
NULL:

    Entering kdb (current=0xffff880036c747c0, pid 4420) on processor 1
Oops: <NULL>
    BUG: unable to handle kernel NULL pointer dereference at
0000000000000080
    IP: [<ffffffff80415ee2>] kdba_getpc+0x0/0x8
    PGD 379f4067 PUD 39997067 PMD 0
    Oops: 0000 [1] SMP
    last sysfs file: /sys/devices/pci0000:00/0000:00:1c.5/0000:06:00.0/irq
    kdb: Debugger re-entered on cpu 1, new reason = 5
         Not executing a kdb command
         No longjmp available for recovery
         Cannot recover, allowing event to proceed

Even if that has ieen fixed, then kdba_dumpregs() crashed because
the return value of kdba_getpc() was assumed to be non-NULL.

This patch simply ports the error handling from its 32 bit counterpart
implementation. After applying that fix, the test mentioned above succeeds:

    Entering kdb (current=0xffff8800355fc480, pid 7564) on processor 1
Oops: <NULL>
    due to oops @ 0x0
    kdba_dumpregs: pt_regs not available, use bt* or pid to select a
different task
    [1]kdb>


Signed-off-by: Bernhard Walle <[EMAIL PROTECTED]>

---
 arch/x86/kdb/kdbasupport_64.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/arch/x86/kdb/kdbasupport_64.c
+++ b/arch/x86/kdb/kdbasupport_64.c
@@ -500,6 +500,11 @@ kdba_dumpregs(struct pt_regs *regs,
                struct kdbregs *rlp;
                kdb_machreg_t contents;

+               if (!regs) {
+                       kdb_printf("%s: pt_regs not available, use bt* or pid 
to select a
different task\n", __FUNCTION__);
+                       return KDB_BADREG;
+               }
+
                for (i=0, rlp=kdbreglist; i<nkdbreglist; i++,rlp++) {
                        kdb_printf("%8s = ", rlp->reg_name);
                        kdba_getregcontents(rlp->reg_name, regs, &contents);
@@ -553,7 +558,7 @@ EXPORT_SYMBOL(kdba_dumpregs);
 kdb_machreg_t
 kdba_getpc(struct pt_regs *regs)
 {
-       return regs->ip;
+       return regs ? regs->ip : 0;
 }

 int
---------------------------
Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe.

Reply via email to