* [PATCH] parisc: improve SIGBUS/SIGSEGV error reporting
@ 2013-11-18 21:12 Helge Deller
0 siblings, 0 replies; only message in thread
From: Helge Deller @ 2013-11-18 21:12 UTC (permalink / raw)
To: linux-parisc, James Bottomley
This patch fixes most of the Linux Test Project testcases, e.g. fstat05.
Signed-off-by: Helge Deller <deller@gmx.de>
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
index 7584a5d..13ff454 100644
--- a/arch/parisc/mm/fault.c
+++ b/arch/parisc/mm/fault.c
@@ -282,16 +282,31 @@ bad_area:
#endif
switch (code) {
case 15: /* Data TLB miss fault/Data page fault */
+ /* Outside of vma area? -> send SIGSEGV */
+ if (!vma ||
+ address < vma->vm_start || address > vma->vm_end)
+ goto send_sigsegv;
+
+ /* Wrong permissions? -> send SIGSEGV */
+ if ((vma->vm_flags & acc_type) != acc_type) {
+ si.si_signo = SIGSEGV;
+ si.si_code = SEGV_ACCERR;
+ break;
+ }
+
+ /* permissions & location OK, but end 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;
+send_sigbus: si.si_signo = SIGBUS;
+ 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;
+send_sigsegv: si.si_signo = SIGSEGV;
+ si.si_code = (code == 26) ? SEGV_ACCERR : SEGV_MAPERR;
+ break;
}
si.si_errno = 0;
si.si_addr = (void __user *) address;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-11-18 21:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-18 21:12 [PATCH] parisc: improve SIGBUS/SIGSEGV error reporting Helge Deller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).