Skip to content

Commit

Permalink
parisc: improve SIGBUS/SIGSEGV error reporting
Browse files Browse the repository at this point in the history
This patch fixes most of the Linux Test Project testcases, e.g. fstat05.

Signed-off-by: Helge Deller <deller@gmx.de>
  • Loading branch information
Helge Deller committed Nov 19, 2013
1 parent 38c7937 commit 49d1cb2
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions arch/parisc/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,34 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
#endif
switch (code) {
case 15: /* Data TLB miss fault/Data page fault */
/* send SIGSEGV when outside of vma */
if (!vma ||
address < vma->vm_start || address > vma->vm_end) {
si.si_signo = SIGSEGV;
si.si_code = SEGV_MAPERR;
break;
}

/* send SIGSEGV for wrong permissions */
if ((vma->vm_flags & acc_type) != acc_type) {
si.si_signo = SIGSEGV;
si.si_code = SEGV_ACCERR;
break;
}

/* probably address is outside of mapped file */
/* fall through */
case 17: /* NA data TLB miss / page fault */
case 18: /* Unaligned access - PCXS only */
si.si_signo = SIGBUS;
si.si_code = BUS_ADRERR;
si.si_code = (code == 18) ? BUS_ADRALN : BUS_ADRERR;
break;
case 16: /* Non-access instruction TLB miss fault */
case 26: /* PCXL: Data memory access rights trap */
default:
si.si_signo = SIGSEGV;
si.si_code = SEGV_MAPERR;
si.si_code = (code == 26) ? SEGV_ACCERR : SEGV_MAPERR;
break;
}
si.si_errno = 0;
si.si_addr = (void __user *) address;
Expand Down

0 comments on commit 49d1cb2

Please sign in to comment.