From: Alexander Nyberg <alexn@telia.com>
To: vgoyal@in.ibm.com
Cc: fastboot@lists.osdl.org,
linux kernel mailing list <linux-kernel@vger.kernel.org>,
Morton Andrew Morton <akpm@osdl.org>
Subject: Re: [Fastboot] [2/2] kdump: Save trap information for later analyzis
Date: Wed, 18 May 2005 16:51:03 +0200 [thread overview]
Message-ID: <1116427863.22324.6.camel@localhost.localdomain> (raw)
In-Reply-To: <20050518124144.GB3657@in.ibm.com>
If we are faulting in kernel it is quite possible this will lead to a
panic. Save trap number, cr2 (in case of page fault) and error_code in
the current thread (these fields already exist for signal delivery but
are not used here).
This helps later kdump crash analyzing from user-space (a script has
been submitted to dig this info out in gdb).
Signed-off-by: Alexander Nyberg <alexn@telia.com>
Index: mm/arch/i386/mm/fault.c
===================================================================
--- mm.orig/arch/i386/mm/fault.c 2005-05-18 16:39:04.000000000 +0200
+++ mm/arch/i386/mm/fault.c 2005-05-18 16:39:20.000000000 +0200
@@ -469,6 +469,9 @@
printk(KERN_ALERT "*pte = %08lx\n", page);
}
#endif
+ tsk->thread.cr2 = address;
+ tsk->thread.trap_no = 14;
+ tsk->thread.error_code = error_code;
die("Oops", regs, error_code);
bust_spinlocks(0);
do_exit(SIGKILL);
Index: mm/arch/i386/kernel/traps.c
===================================================================
--- mm.orig/arch/i386/kernel/traps.c 2005-05-18 16:39:04.000000000 +0200
+++ mm/arch/i386/kernel/traps.c 2005-05-18 16:39:20.000000000 +0200
@@ -410,6 +410,10 @@
static void do_trap(int trapnr, int signr, char *str, int vm86,
struct pt_regs * regs, long error_code, siginfo_t *info)
{
+ struct task_struct *tsk = current;
+ tsk->thread.error_code = error_code;
+ tsk->thread.trap_no = trapnr;
+
if (regs->eflags & VM_MASK) {
if (vm86)
goto vm86_trap;
@@ -420,9 +424,6 @@
goto kernel_trap;
trap_signal: {
- struct task_struct *tsk = current;
- tsk->thread.error_code = error_code;
- tsk->thread.trap_no = trapnr;
if (info)
force_sig_info(signr, info, tsk);
else
@@ -537,6 +538,9 @@
}
put_cpu();
+ current->thread.error_code = error_code;
+ current->thread.trap_no = 13;
+
if (regs->eflags & VM_MASK)
goto gp_in_vm86;
@@ -977,9 +981,9 @@
error_code);
return;
}
- die_if_kernel("cache flush denied", regs, error_code);
current->thread.trap_no = 19;
current->thread.error_code = error_code;
+ die_if_kernel("cache flush denied", regs, error_code);
force_sig(SIGSEGV, current);
}
}
prev parent reply other threads:[~2005-05-18 14:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1116103800.6153.31.camel@localhost.localdomain>
2005-05-18 12:41 ` Vivek Goyal
2005-05-18 14:51 ` Alexander Nyberg [this message]
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=1116427863.22324.6.camel@localhost.localdomain \
--to=alexn@telia.com \
--cc=akpm@osdl.org \
--cc=fastboot@lists.osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vgoyal@in.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®