forked from Minki/linux
um: print info about fatal segfaults
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>
This commit is contained in:
parent
4ff4d8d342
commit
3ef6130ab2
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user