]> git.baikalelectronics.ru Git - kernel.git/commitdiff
parisc: Report SIGSEGV instead of SIGBUS when running out of stack
authorHelge Deller <deller@gmx.de>
Sun, 2 Jul 2017 20:00:41 +0000 (22:00 +0200)
committerHelge Deller <deller@gmx.de>
Sun, 2 Jul 2017 20:27:08 +0000 (22:27 +0200)
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 libsigsegv package.

Cc: stable@vger.kernel.org
Signed-off-by: Helge Deller <deller@gmx.de>
arch/parisc/mm/fault.c

index 41448f7b2b2a089a2ea31c52befc26b87bb111ac..5b101f6a5607dc1ef9e229b6f2421a78d35355ce 100644 (file)
@@ -359,7 +359,7 @@ bad_area:
                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;