From: Helge Deller Date: Thu, 7 Nov 2013 16:08:36 +0000 (+0100) Subject: parisc: signal fixup - SIGBUS vs. SIGSEGV X-Git-Tag: submit/tizen/20160422.055611~1^2~99^2~18^2~2792^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1f2048fd8bc4219db821611da305a74f4b72b3c3;p=sdk%2Femulator%2Femulator-kernel.git parisc: signal fixup - SIGBUS vs. SIGSEGV Clean up code to send correct signal on invalid memory accesses: Send SIGBUS instead of SIGSEGV for memory accesses outside of mmap'ed areas This fixes the mmap13 testcase from the Linux Test Project. Signed-off-by: Helge Deller --- diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c index df0d32971cdf..7584a5df0fa4 100644 --- a/arch/parisc/mm/fault.c +++ b/arch/parisc/mm/fault.c @@ -280,12 +280,22 @@ bad_area: } show_regs(regs); #endif - /* FIXME: actually we need to get the signo and code correct */ - si.si_signo = SIGSEGV; + switch (code) { + case 15: /* Data TLB miss fault/Data page fault */ + case 17: /* NA data TLB miss / page fault */ + case 18: /* Unaligned access - PCXS only */ + si.si_signo = SIGBUS; + si.si_code = 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_errno = 0; - si.si_code = SEGV_MAPERR; si.si_addr = (void __user *) address; - force_sig_info(SIGSEGV, &si, current); + force_sig_info(si.si_signo, &si, current); return; }