Linux PARISC architecture development
 help / color / mirror / Atom feed
* [PATCH] parisc: Report SIGSEGV instead of SIGBUS when running out of stack
@ 2017-07-02 20:00 Helge Deller
  0 siblings, 0 replies; only message in thread
From: Helge Deller @ 2017-07-02 20:00 UTC (permalink / raw)
  To: linux-parisc, James Bottomley, John David Anglin

When a process runs out of stack the parisc kernel wrongly faults with SIGBUS
instead of the expected SIGSEGV signal.

This example shows how the kernel faults:
do_page_fault() command='a.out' type=15 address=0xfaac2000 in libc-2.24.so[f8308000+16c000]
trap #15: Data TLB miss fault, vm_start = 0xfa2c2000, vm_end = 0xfaac2000

The vma->vm_end value is the first address which does not belong to the vma, so
adjust the check to include vma->vm_end to the range for which to send the
SIGSEGV signal.

This patch unbreaks building the debian libsegv package.

Cc: stable@vger.kernel.org
Signed-off-by: Helge Deller <deller@gmx.de>

diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
index 32ec221..9fd95fe 100644
--- a/arch/parisc/mm/fault.c
+++ b/arch/parisc/mm/fault.c
@@ -367,7 +367,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long 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) {
+			    address < vma->vm_start || address >= vma->vm_end) {
 				si.si_signo = SIGSEGV;
 				si.si_code = SEGV_MAPERR;
 				break;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-07-02 20:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-02 20:00 [PATCH] parisc: Report SIGSEGV instead of SIGBUS when running out of stack Helge Deller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox