Skip to content

Commit

Permalink
um: print info about fatal segfaults
Browse files Browse the repository at this point in the history
Print a short info about fatal segfaults like other archs do.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Richard Weinberger authored and Linus Torvalds committed May 25, 2011
1 parent 4ff4d8d commit 3ef6130
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions arch/um/kernel/trap.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,27 @@ int handle_page_fault(unsigned long address, unsigned long ip,
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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 3ef6130

Please sign in to comment.