From: Richard Weinberger <richard@nod.at>
To: akpm@linux-foundation.org
Cc: user-mode-linux-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, Richard Weinberger <richard@nod.at>
Subject: [PATCH 5/7] um: print info about fatal segfaults
Date: Sun, 22 May 2011 16:48:34 +0200 [thread overview]
Message-ID: <1306075716-20042-5-git-send-email-richard@nod.at> (raw)
In-Reply-To: <1306075716-20042-1-git-send-email-richard@nod.at>
Print a short info about fatal segfaults like other archs do.
Signed-off-by: Richard Weinberger <richard@nod.at>
---
arch/um/kernel/trap.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c
index 637c650..8c7b882 100644
--- a/arch/um/kernel/trap.c
+++ b/arch/um/kernel/trap.c
@@ -113,6 +113,27 @@ out_of_memory:
return 0;
}
+static void show_segv_info(struct uml_pt_regs *regs)
+{
+ struct task_struct *tsk = current;
+ struct faultinfo *fi = UPT_FAULTINFO(regs);
+
+ if (!unhandled_signal(tsk, SIGSEGV))
+ return;
+
+ if (!printk_ratelimit())
+ return;
+
+ printk("%s%s[%d]: segfault at %lx ip %p sp %p error %x",
+ task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG,
+ tsk->comm, task_pid_nr(tsk), FAULT_ADDRESS(*fi),
+ (void *)UPT_IP(regs), (void *)UPT_SP(regs),
+ fi->error_code);
+
+ print_vma_addr(KERN_CONT " in ", UPT_IP(regs));
+ printk(KERN_CONT "\n");
+}
+
static void bad_segv(struct faultinfo fi, unsigned long ip)
{
struct siginfo si;
@@ -141,6 +162,7 @@ void segv_handler(int sig, struct uml_pt_regs *regs)
struct faultinfo * fi = UPT_FAULTINFO(regs);
if (UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)) {
+ show_segv_info(regs);
bad_segv(*fi, UPT_IP(regs));
return;
}
@@ -202,6 +224,8 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
address, ip);
}
+ show_segv_info(regs);
+
if (err == -EACCES) {
si.si_signo = SIGBUS;
si.si_errno = 0;
--
1.7.4.2
next prev parent reply other threads:[~2011-05-22 14:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-22 14:48 [PATCH 1/7] um: fix UML_LIB_PATH Richard Weinberger
2011-05-22 14:48 ` [PATCH 2/7] um: remove SIGHUP handler Richard Weinberger
2011-05-22 14:48 ` [PATCH 3/7] um: add earlyprintk support Richard Weinberger
2011-05-22 14:48 ` [PATCH 4/7] um: add ucast ethernet transport Richard Weinberger
2011-05-22 14:48 ` Richard Weinberger [this message]
2011-05-24 19:34 ` [PATCH 5/7] um: print info about fatal segfaults Andrew Morton
2011-05-24 20:02 ` [PATCH] checkpatch: Add warning for uses of printk_ratelimit Joe Perches
2011-05-24 20:14 ` [PATCH 5/7] um: print info about fatal segfaults Richard Weinberger
2011-05-22 14:48 ` [PATCH 6/7] um: include linux/prefetch.h Richard Weinberger
2011-05-22 14:48 ` [PATCH 7/7] um: fix crash while os_dump_core() Richard Weinberger
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=1306075716-20042-5-git-send-email-richard@nod.at \
--to=richard@nod.at \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/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®