From patchwork Sun Jul 2 20:00:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 9821761 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7916360353 for ; Sun, 2 Jul 2017 20:00:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6505327F54 for ; Sun, 2 Jul 2017 20:00:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58C0727F9A; Sun, 2 Jul 2017 20:00:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B512527F54 for ; Sun, 2 Jul 2017 20:00:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751894AbdGBUAx (ORCPT ); Sun, 2 Jul 2017 16:00:53 -0400 Received: from mout.gmx.net ([212.227.17.22]:53216 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751889AbdGBUAw (ORCPT ); Sun, 2 Jul 2017 16:00:52 -0400 Received: from p100.box ([193.159.25.122]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MVIva-1dDyJW0en0-00Yisv; Sun, 02 Jul 2017 22:00:44 +0200 Date: Sun, 2 Jul 2017 22:00:41 +0200 From: Helge Deller To: linux-parisc@vger.kernel.org, James Bottomley , John David Anglin Subject: [PATCH] parisc: Report SIGSEGV instead of SIGBUS when running out of stack Message-ID: <20170702200041.GA15902@p100.box> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Provags-ID: V03:K0:LCb/pwJzFP+eAnl/P8JJK6TSdMsF7KTnW9iJq9XNqJSuB7Jz+DP kl2BEKtDS0T3ieB8CvnHqHp03Slf6ng9LxShA0Fc0osOfUTI6ILm8d8wnrwHuzl1VcAV73i 2F8K36b/DC62Iqpbo7/G+TlUD909YXniaUWnVRvFwQonNCC5l7xgKegr9pPk6GwnljDmUOn qrhuVVqwe91ynhwy1w2AA== X-UI-Out-Filterresults: notjunk:1; V01:K0:yAPFyzwvx2Q=:lfnwzuK1tR/6ze7v22y6m6 oF4pIo4Bw7QLGhqw6OOCigBNUXjIWV3HqlrN3zXjQEYguOqzLY8egoxJizDCELIysB3PebMyo LOkTVQXbF/erzJup07Faim+6zBegJM/NcYUT/oiv7daV5JI01RtMAC2eJmMWeuCaSlPevlG1i WYtBGE9wVuIteQ9L9O45WfuTPmJDMb4tVUiX4je8txKz7DnT0DWep5jqdyv5eCo7+7tJd/JE3 K+hqlMdKQgW54s3JVhjCndr7MN+TJmHcve7x0MT2Oczm0ibiOkBqSKtHnGEAvcBluQstnFLs1 tLUOdBx8jeZ/z/jwdpvkHxDaLE7R5t6AUUdoPmNPMdRKVzNd1v53AEkvdyXuRonSLI39U479N uunKpMkmiRxoN9I0F1b70hSEFBz6PFqpLZZdNjqxYYAYkAX6xNGIEqVp4T2D1KCqHtZehmSuT 7vwzhlq6z79yapYP32EkirWxw4tFqUMGM6UyL0d1eepDm4uIZnAQp0ylloNtToeSOqcXXpgTI r+3RsdPzVa6guD1vuDZ3tFyqRoogpu4Xee+CgYqZC38dNLtj3Nhz8hY5oSuzt9jOgF8cUc5WR ZD3HuwnFR1Fv0B4coVuRThhwXTo4EST7I8gAiI+jx31RMhd+4JXhmuZCU1RxgVDLAMMaqaTV8 sw4mlFSBrp0e5sPaLEqMQX7q+MiOA7LUMH9oFq5miZQf6Zq9MOPywcB0myCWSGlWj6fH8eioc uy7qZK9JPBeXegVy8Ms3FUhSdTWdRf4SU2nHDFcbtSx1IOK/cSbBn5esqvU= Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;