diff options
author | Helge Deller <deller@gmx.de> | 2013-11-18 16:12:11 -0500 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2013-11-19 17:36:18 -0500 |
commit | 49d1cb2bcadfc5cea4b700a0ec6b957567889714 (patch) | |
tree | 233750543d819d8a12fefdc0b244b883c2c4e5b3 /arch | |
parent | 38c7937379276a5ea8c54481205003af2f2b5694 (diff) |
parisc: improve SIGBUS/SIGSEGV error reporting
This patch fixes most of the Linux Test Project testcases, e.g. fstat05.
Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/parisc/mm/fault.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c index 7584a5df0fa4..9d08c71a967e 100644 --- a/arch/parisc/mm/fault.c +++ b/arch/parisc/mm/fault.c | |||
@@ -282,16 +282,34 @@ bad_area: | |||
282 | #endif | 282 | #endif |
283 | switch (code) { | 283 | switch (code) { |
284 | case 15: /* Data TLB miss fault/Data page fault */ | 284 | case 15: /* Data TLB miss fault/Data page fault */ |
285 | /* send SIGSEGV when outside of vma */ | ||
286 | if (!vma || | ||
287 | address < vma->vm_start || address > vma->vm_end) { | ||
288 | si.si_signo = SIGSEGV; | ||
289 | si.si_code = SEGV_MAPERR; | ||
290 | break; | ||
291 | } | ||
292 | |||
293 | /* send SIGSEGV for wrong permissions */ | ||
294 | if ((vma->vm_flags & acc_type) != acc_type) { | ||
295 | si.si_signo = SIGSEGV; | ||
296 | si.si_code = SEGV_ACCERR; | ||
297 | break; | ||
298 | } | ||
299 | |||
300 | /* probably address is outside of mapped file */ | ||
301 | /* fall through */ | ||
285 | case 17: /* NA data TLB miss / page fault */ | 302 | case 17: /* NA data TLB miss / page fault */ |
286 | case 18: /* Unaligned access - PCXS only */ | 303 | case 18: /* Unaligned access - PCXS only */ |
287 | si.si_signo = SIGBUS; | 304 | si.si_signo = SIGBUS; |
288 | si.si_code = BUS_ADRERR; | 305 | si.si_code = (code == 18) ? BUS_ADRALN : BUS_ADRERR; |
289 | break; | 306 | break; |
290 | case 16: /* Non-access instruction TLB miss fault */ | 307 | case 16: /* Non-access instruction TLB miss fault */ |
291 | case 26: /* PCXL: Data memory access rights trap */ | 308 | case 26: /* PCXL: Data memory access rights trap */ |
292 | default: | 309 | default: |
293 | si.si_signo = SIGSEGV; | 310 | si.si_signo = SIGSEGV; |
294 | si.si_code = SEGV_MAPERR; | 311 | si.si_code = (code == 26) ? SEGV_ACCERR : SEGV_MAPERR; |
312 | break; | ||
295 | } | 313 | } |
296 | si.si_errno = 0; | 314 | si.si_errno = 0; |
297 | si.si_addr = (void __user *) address; | 315 | si.si_addr = (void __user *) address; |