From patchwork Mon Sep 24 14:49:09 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: 973946 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=xmission.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JmqSzg/g"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42JnJX2cTdz9sCc for ; Tue, 25 Sep 2018 00:53:32 +1000 (AEST) 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=3vJC43TXMllhX6vHt0et/Zjqc51UB0HZsNjxyt5Bm3U=; b=JmqSzg/g2uSh92 Ob8ztfIK3ACS+MgUzAgnmwUbS5BRImjHkxQ/1ijbszOLYv2aG3Q7fsMaVA+B+DZuLcifIbujnl2jn 2FeC3qYNMvjojtNX3Vkvd+aj0DrPiSFRj4hsKI6w0WHSnskRa2cgyqfWeYVy7F2miiZI3HtldRBPY 1NOuJ9sNK2Wivk5Zcnz2bipa7XoGtzgqjLSRA8E+0DAtgd6MifWU/xyPDSRXW7q3ZNBg0s92RXQu0 /sM75RVIyFrdNS456HsbTU7+UGo1GGMmcgalh2adbGXjcJRJ1FZs/UAs7G7sAbFBx8hLvU5BQUsp6 5QI/JEF5Cj+ORjDzuXjg==; 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 1g4SEs-00020b-4R; Mon, 24 Sep 2018 14:53:30 +0000 Received: from out01.mta.xmission.com ([166.70.13.231]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g4SBb-0008AM-LZ for linux-snps-arc@lists.infradead.org; Mon, 24 Sep 2018 14:50:27 +0000 Received: from in02.mta.xmission.com ([166.70.13.52]) by out01.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1g4SB7-0001dH-PY; Mon, 24 Sep 2018 08:49:37 -0600 Received: from [105.184.227.67] (helo=x220.Home) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA256:128) (Exim 4.87) (envelope-from ) id 1g4SB6-0002hz-QP; Mon, 24 Sep 2018 08:49:37 -0600 From: "Eric W. Biederman" To: linux-kernel@vger.kernel.org Date: Mon, 24 Sep 2018 16:49:09 +0200 Message-Id: <20180924144910.14902-1-ebiederm@xmission.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <874lef2bqn.fsf@xmission.com> References: <874lef2bqn.fsf@xmission.com> X-XM-SPF: eid=1g4SB6-0002hz-QP; ; ; mid=<20180924144910.14902-1-ebiederm@xmission.com>; ; ; hst=in02.mta.xmission.com; ; ; ip=105.184.227.67; ; ; frm=ebiederm@xmission.com; ; ; spf=neutral X-XM-AID: U2FsdGVkX18c/MIjvdxmq+3uGmMuc03pds/y2avbelE= X-SA-Exim-Connect-IP: 105.184.227.67 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa08.xmission.com X-Spam-Level: *** X-Spam-Status: No, score=3.5 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE, TR_Symld_Words, T_TooManySym_01, XMNoVowels, XMSubLong autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.7 XMSubLong Long Subject * 1.5 TR_Symld_Words too many words that have symbols inside * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4947] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa08 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa08 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ***;linux-kernel@vger.kernel.org X-Spam-Relay-Country: X-Spam-Timing: total 170 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 4.3 (2.5%), b_tie_ro: 3.0 (1.8%), parse: 0.60 (0.4%), extract_message_metadata: 8 (4.7%), get_uri_detail_list: 0.99 (0.6%), tests_pri_-1000: 4.6 (2.7%), tests_pri_-950: 1.13 (0.7%), tests_pri_-900: 0.92 (0.5%), tests_pri_-400: 17 (10.2%), check_bayes: 16 (9.6%), b_tokenize: 4.6 (2.7%), b_tok_get_all: 5 (3.1%), b_comp_prob: 1.34 (0.8%), b_tok_touch_all: 2.8 (1.6%), b_finish: 0.68 (0.4%), tests_pri_0: 125 (73.6%), check_dkim_signature: 0.42 (0.2%), check_dkim_adsp: 2.7 (1.6%), tests_pri_500: 6 (3.4%), rewrite_mail: 0.00 (0.0%) Subject: [REVIEW][PATCH 1/2] signal/arc: Push siginfo generation into unhandled_exception X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180924_075008_004866_9D3F7B01 X-CRM114-Status: UNSURE ( 5.83 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [166.70.13.231 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Vineet Gupta , linux-snps-arc@lists.infradead.org, "Eric W. Biederman" MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Pass signr, sicode, and address into unhandled_exception as explicit parameters instead of members of struct siginfo. Then in unhandled exception generate and send the siginfo using force_sig_fault. This keeps the code simpler and less error prone. Signed-off-by: "Eric W. Biederman" Acked-by: Vineet Gupta --- arch/arc/kernel/traps.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/arch/arc/kernel/traps.c b/arch/arc/kernel/traps.c index b123558bf0bb..a7fcbc0d3943 100644 --- a/arch/arc/kernel/traps.c +++ b/arch/arc/kernel/traps.c @@ -42,21 +42,22 @@ void die(const char *str, struct pt_regs *regs, unsigned long address) * -for kernel, chk if due to copy_(to|from)_user, otherwise die() */ static noinline int -unhandled_exception(const char *str, struct pt_regs *regs, siginfo_t *info) +unhandled_exception(const char *str, struct pt_regs *regs, + int signo, int si_code, void __user *addr) { if (user_mode(regs)) { struct task_struct *tsk = current; - tsk->thread.fault_address = (__force unsigned int)info->si_addr; + tsk->thread.fault_address = (__force unsigned int)addr; - force_sig_info(info->si_signo, info, tsk); + force_sig_fault(signo, si_code, addr, tsk); } else { /* If not due to copy_(to|from)_user, we are doomed */ if (fixup_exception(regs)) return 0; - die(str, regs, (unsigned long)info->si_addr); + die(str, regs, (unsigned long)addr); } return 1; @@ -64,16 +65,9 @@ unhandled_exception(const char *str, struct pt_regs *regs, siginfo_t *info) #define DO_ERROR_INFO(signr, str, name, sicode) \ int name(unsigned long address, struct pt_regs *regs) \ -{ \ - siginfo_t info; \ - \ - clear_siginfo(&info); \ - info.si_signo = signr; \ - info.si_errno = 0; \ - info.si_code = sicode; \ - info.si_addr = (void __user *)address; \ - \ - return unhandled_exception(str, regs, &info);\ +{ \ + return unhandled_exception(str, regs, signr, sicode, \ + (void __user *)address); \ } /* From patchwork Mon Sep 24 14:49:10 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: 973945 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=xmission.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="b+iaJdWI"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42JnHS2nyTz9sMr for ; Tue, 25 Sep 2018 00:52:36 +1000 (AEST) 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=aunRxatdlEmJlI31eK4dYDX99n7VXr63JISbtRjhPFc=; b=b+iaJdWIgTvKAe XAe1bXGyu8bOCumjaFd+7KDm7CHbW14CBu+4eaajhv02xaP5UxhjwLhFIi1oc9Y1gOmkndJBSapSJ Q16d/ZjnfhgDbVK1erF5OmYoChSjex7YwUvS0QaVtwaAj2wy+coGmWlAzeEsUERNywoKXreTyXDi7 A5a8bcizwpI6lqtxKoE8Ku3GGG9mcy2gosgw3Mh6qTTguzTO67Gyxq0avX6rKXnG2yChLg4Bjs5V2 t+esoIYliY47yFTa5SRIVR15gIeRxnCHbH/UqIyRl3om5366kiGnCybq/RFFC0iv0ak9ofZDkhYjG RGxpk9tqbIfE+zKE3FuA==; 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 1g4SDw-0001tq-Rd; Mon, 24 Sep 2018 14:52:32 +0000 Received: from out02.mta.xmission.com ([166.70.13.232]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g4SBw-0008DX-7k for linux-snps-arc@lists.infradead.org; Mon, 24 Sep 2018 14:50:38 +0000 Received: from in02.mta.xmission.com ([166.70.13.52]) by out02.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1g4SBQ-0005Al-RL; Mon, 24 Sep 2018 08:49:56 -0600 Received: from [105.184.227.67] (helo=x220.Home) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA256:128) (Exim 4.87) (envelope-from ) id 1g4SBA-0002hz-Tl; Mon, 24 Sep 2018 08:49:56 -0600 From: "Eric W. Biederman" To: linux-kernel@vger.kernel.org Date: Mon, 24 Sep 2018 16:49:10 +0200 Message-Id: <20180924144910.14902-2-ebiederm@xmission.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <874lef2bqn.fsf@xmission.com> References: <874lef2bqn.fsf@xmission.com> X-XM-SPF: eid=1g4SBA-0002hz-Tl; ; ; mid=<20180924144910.14902-2-ebiederm@xmission.com>; ; ; hst=in02.mta.xmission.com; ; ; ip=105.184.227.67; ; ; frm=ebiederm@xmission.com; ; ; spf=neutral X-XM-AID: U2FsdGVkX1/bezPz51fGHFTUtfa1C6Li66o8Z5BOalc= X-SA-Exim-Connect-IP: 105.184.227.67 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa06.xmission.com X-Spam-Level: *** X-Spam-Status: No, score=3.5 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE, TR_Symld_Words, T_TooManySym_01, XMNoVowels, XMSubLong autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 1.5 XMNoVowels Alpha-numberic number with no vowels * 1.5 TR_Symld_Words too many words that have symbols inside * 0.7 XMSubLong Long Subject * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4940] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ***;linux-kernel@vger.kernel.org X-Spam-Relay-Country: X-Spam-Timing: total 15025 ms - load_scoreonly_sql: 0.04 (0.0%), signal_user_changed: 2.9 (0.0%), b_tie_ro: 2.1 (0.0%), parse: 0.79 (0.0%), extract_message_metadata: 10 (0.1%), get_uri_detail_list: 1.27 (0.0%), tests_pri_-1000: 2.8 (0.0%), tests_pri_-950: 1.23 (0.0%), tests_pri_-900: 1.01 (0.0%), tests_pri_-400: 19 (0.1%), check_bayes: 18 (0.1%), b_tokenize: 6 (0.0%), b_tok_get_all: 6 (0.0%), b_comp_prob: 1.58 (0.0%), b_tok_touch_all: 2.8 (0.0%), b_finish: 0.66 (0.0%), tests_pri_0: 161 (1.1%), check_dkim_signature: 0.48 (0.0%), check_dkim_adsp: 2.7 (0.0%), tests_pri_500: 14824 (98.7%), poll_dns_idle: 14812 (98.6%), rewrite_mail: 0.00 (0.0%) Subject: [REVIEW][PATCH 2/2] signal/arc: Use force_sig_fault where appropriate X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180924_075028_404194_FA32C9AA X-CRM114-Status: UNSURE ( 6.89 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [166.70.13.232 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Vineet Gupta , linux-snps-arc@lists.infradead.org, "Eric W. Biederman" MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: "Eric W. Biederman" Acked-by: Vineet Gupta --- arch/arc/mm/fault.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c index db6913094be3..c9da6102eb4f 100644 --- a/arch/arc/mm/fault.c +++ b/arch/arc/mm/fault.c @@ -66,14 +66,12 @@ void do_page_fault(unsigned long address, struct pt_regs *regs) struct vm_area_struct *vma = NULL; struct task_struct *tsk = current; struct mm_struct *mm = tsk->mm; - siginfo_t info; + int si_code; int ret; vm_fault_t fault; int write = regs->ecr_cause & ECR_C_PROTV_STORE; /* ST/EX */ unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; - clear_siginfo(&info); - /* * We fault-in kernel-space virtual memory on-demand. The * 'reference' page table is init_mm.pgd. @@ -91,7 +89,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs) return; } - info.si_code = SEGV_MAPERR; + si_code = SEGV_MAPERR; /* * If we're in an interrupt or have no user @@ -119,7 +117,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs) * we can handle it.. */ good_area: - info.si_code = SEGV_ACCERR; + si_code = SEGV_ACCERR; /* Handle protection violation, execute on heap or stack */ @@ -199,11 +197,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs) /* User mode accesses just cause a SIGSEGV */ if (user_mode(regs)) { tsk->thread.fault_address = address; - info.si_signo = SIGSEGV; - info.si_errno = 0; - /* info.si_code has been set above */ - info.si_addr = (void __user *)address; - force_sig_info(SIGSEGV, &info, tsk); + force_sig_fault(SIGSEGV, si_code, (void __user *)address, tsk); return; } @@ -238,9 +232,5 @@ void do_page_fault(unsigned long address, struct pt_regs *regs) goto no_context; tsk->thread.fault_address = address; - info.si_signo = SIGBUS; - info.si_errno = 0; - info.si_code = BUS_ADRERR; - info.si_addr = (void __user *)address; - force_sig_info(SIGBUS, &info, tsk); + force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, tsk); }