From patchwork Mon Sep 24 09:10:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Eric W. Biederman" X-Patchwork-Id: 10612105 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0E47E13A4 for ; Mon, 24 Sep 2018 09:32:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC5C229ECB for ; Mon, 24 Sep 2018 09:32:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E06D929ED4; Mon, 24 Sep 2018 09:32:48 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 75B1A29ECB for ; Mon, 24 Sep 2018 09:32:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=87PZOaHECazhBmJmHOTq0wwLuBzGCF8q6YsxoTFMQA0=; b=OrgUCeOdCbNbTG dqPzku4fw+KtZSCrgDghwdpJv75sEVp5tOtBPxlfPfSrdd3OauwNecWdtGaGPeahy7pqfO/hJqFWn 1GyBVlyHBNZmU2mGu+ihXFbqICHzx5MzCz8W/amyrpJpFk+mxi9xcIiav8mItepjlztlcmzQciptC byrWmxOiXp1lTYzHm+uou17tiPoLNHITdO+MrtBUDr5usBFNWJsICpc+vkOVlIDvdjSJc5OySPwD/ U4Kdo/hns3kABoP+yzMZUQuIo36xBE6sxLc2z1IiNBJUFA0mofUBbx4udExbBFMB8xP8qeqYAzePf +QyITDnUZiBcFOTm8l/w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g4NEI-0001xA-Aw; Mon, 24 Sep 2018 09:32:34 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g4N8Q-0006RP-VY for linux-arm-kernel@bombadil.infradead.org; Mon, 24 Sep 2018 09:26:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Subject:References:In-Reply-To: Message-Id:Date:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=At3bv0PAvB856gtdKkZDe0Mxe1Db1nJPN2NsX/7OG68=; b=bOuuqV68UHcFU/lYoUib/xRUr 5TJ1Yy1MuSslZKU4CUv1Ce0rY5VrLr5rWOGvXZPytTIhN6pJLKTJ8MkDKR5AnQgWrjoULdgMYIrmG qLW591u22wL1gfJflfN9woOE5M/kxhsRKEvOxmX/x+ek9ZEoQzsxTrlh3smXy9/746CCSDrqpRkfU JG1EVavvkMmQpHcMBW5krvUkPMLR1XagNQ8ILhGIelwJ4XI011I3BC7/JA/kLeEhQGekHpYcKGpkS FQ1H9YMpdosJ6a4+QUT9LhIIVVITcc9NCqSwoibqWvfLQs0T4h0gdxeXY/8GBwlx26QdjDnh9fYOF +IwoAJTFw==; Received: from out03.mta.xmission.com ([166.70.13.233]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g4Muh-0000CF-Gy for linux-arm-kernel@lists.infradead.org; Mon, 24 Sep 2018 09:12:20 +0000 Received: from in01.mta.xmission.com ([166.70.13.51]) by out03.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1g4MuV-0008FU-VP; Mon, 24 Sep 2018 03:12:08 -0600 Received: from [105.184.227.67] (helo=x220.Home) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA256:128) (Exim 4.87) (envelope-from ) id 1g4MuF-0002zU-RB; Mon, 24 Sep 2018 03:12:07 -0600 From: "Eric W. Biederman" To: linux-kernel@vger.kernel.org Date: Mon, 24 Sep 2018 11:10:06 +0200 Message-Id: <20180924091015.4458-6-ebiederm@xmission.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <871s9j462u.fsf@xmission.com> References: <871s9j462u.fsf@xmission.com> X-XM-SPF: eid=1g4MuF-0002zU-RB; ; ; mid=<20180924091015.4458-6-ebiederm@xmission.com>; ; ; hst=in01.mta.xmission.com; ; ; ip=105.184.227.67; ; ; frm=ebiederm@xmission.com; ; ; spf=neutral X-XM-AID: U2FsdGVkX1/Oo7+Q8SiNwfUGFpOczkJ9+qaJL7AudL4= X-SA-Exim-Connect-IP: 105.184.227.67 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: [REVIEW][PATCH 06/15] signal/arm64: For clarity separate the 3 signal sending cases in do_page_fault X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180924_051219_663875_256E6743 X-CRM114-Status: GOOD ( 11.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Catalin Marinas , Will Deacon , "Eric W. Biederman" , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP It gets easy to confuse what is going on when some code is shared and some not so stop sharing the trivial bits of signal generation to make future updates easier to understand. Signed-off-by: "Eric W. Biederman" --- arch/arm64/mm/fault.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 0ddc8c6ba53b..14d6ff895139 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -567,16 +567,16 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr, return 0; } - clear_siginfo(&si); - si.si_addr = (void __user *)addr; - if (fault & VM_FAULT_SIGBUS) { /* * We had some memory, but were unable to successfully fix up * this page fault. */ + clear_siginfo(&si); si.si_signo = SIGBUS; si.si_code = BUS_ADRERR; + si.si_addr = (void __user *)addr; + __do_user_fault(&si, esr); } else if (fault & (VM_FAULT_HWPOISON_LARGE | VM_FAULT_HWPOISON)) { unsigned int lsb; @@ -584,20 +584,25 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr, if (fault & VM_FAULT_HWPOISON_LARGE) lsb = hstate_index_to_shift(VM_FAULT_GET_HINDEX(fault)); + clear_siginfo(&si); si.si_signo = SIGBUS; si.si_code = BUS_MCEERR_AR; + si.si_addr = (void __user *)addr; si.si_addr_lsb = lsb; + __do_user_fault(&si, esr); } else { /* * Something tried to access memory that isn't in our memory * map. */ + clear_siginfo(&si); si.si_signo = SIGSEGV; si.si_code = fault == VM_FAULT_BADACCESS ? SEGV_ACCERR : SEGV_MAPERR; + si.si_addr = (void __user *)addr; + __do_user_fault(&si, esr); } - __do_user_fault(&si, esr); return 0; no_context: