Received: by 10.192.165.148 with SMTP id m20csp876629imm; Wed, 25 Apr 2018 09:01:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx49AW5bpqMn8GYNnRZOFjMWMijTJsvp0DgRZtTy31/dROOEnPw7E8gPewbHNowqtRmThWtx9 X-Received: by 10.99.119.2 with SMTP id s2mr23845444pgc.399.1524672071279; Wed, 25 Apr 2018 09:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524672070; cv=none; d=google.com; s=arc-20160816; b=IT/5J3yfhPrmBK32znuJWPshA9bjXkOnwFL0ERp9JBpRyurVVbQ3C0QZldKJqIQ2ab oUXn26Nnu1gUs+Bvtpr8E7/TuIv9kOhmwYkpBvw43NiltCvwzEjrv27JW/nOLyXtGE04 kHumSJsofm3splx22jbAfn9mHuIGXBdVnspjiSQpxGtqHaAmynfMqfScrcxdqjYYWgRf qULLc/Bpru759ZX/QIKnwkU4NoNLfdvSU4Z2Cs3PhSnptiIeLxlDfC0TmoQtr/z3bdTe sT3iMVx9JKvAx2CCibPxxLpUs1slIKbFCe7HMKXcnwOtUJzJpvEuxZ0jLlb5UVzxwqHx oLSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from :arc-authentication-results; bh=ffhgf+9g7hYSQxMCE1SOV5LOWBy5zXirA06O66f9hMQ=; b=X0H+Me9Cm9IIP46tHRtuu1XYoMgx6YC6efNeoU1aPnSdJYxMsE1qfCt2duSGLXR+FD Isbfvxpac7jDux72bcZMgEUFzRfP1ehldDIMZfFZwW7Gn0Ykv9UcdxIeF3Ed6irmGaXy ZwI0VbvN0ihHsOgfhT+byuUnKzoi8VdgiLlFpwznRzFVXEklfQLDpp26oJtszb+CqFuT YLsOCNp/Kydn58VeLgggyCFMANU+HekKEeK8qxOnofHFQr7+Ebv3zeWHvkNjHfABr7X0 aLGQXr/BAEMAHsAB88JZOWY0fFDMVfI3CByjz7EhK6doMlFp83hrfk5+uIWl1AnygccI 3Qvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p16si13852355pgc.241.2018.04.25.09.00.55; Wed, 25 Apr 2018 09:01:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755616AbeDYP6y (ORCPT + 99 others); Wed, 25 Apr 2018 11:58:54 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:38822 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755519AbeDYP6s (ORCPT ); Wed, 25 Apr 2018 11:58:48 -0400 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 1fBMoh-0005k1-T7; Wed, 25 Apr 2018 09:58:47 -0600 Received: from [97.119.174.25] (helo=x220.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fBMoh-0001hu-A0; Wed, 25 Apr 2018 09:58:47 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Vincent Chen Cc: linux-arch , Linux Kernel Mailing List , Greentime Hu References: <87604mhrnb.fsf@xmission.com> <20180420143811.9994-9-ebiederm@xmission.com> Date: Wed, 25 Apr 2018 10:57:22 -0500 In-Reply-To: (Vincent Chen's message of "Wed, 25 Apr 2018 19:29:34 +0800") Message-ID: <87wowvuvml.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1fBMoh-0001hu-A0;;;mid=<87wowvuvml.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=97.119.174.25;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+fLW+msX5mTyw3kDXLhHn3tKBMtRUkoKk= X-SA-Exim-Connect-IP: 97.119.174.25 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa05.xmission.com X-Spam-Level: *** X-Spam-Status: No, score=3.6 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TR_Symld_Words,T_TM2_M_HEADER_IN_MSG,T_TooManySym_01, XMNoVowels,XMSolicitRefs_0,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.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa05 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 0.1 XMSolicitRefs_0 Weightloss drug X-Spam-DCC: XMission; sa05 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ***;Vincent Chen X-Spam-Relay-Country: X-Spam-Timing: total 263 ms - load_scoreonly_sql: 0.09 (0.0%), signal_user_changed: 5.0 (1.9%), b_tie_ro: 2.4 (0.9%), parse: 1.32 (0.5%), extract_message_metadata: 16 (6.1%), get_uri_detail_list: 3.1 (1.2%), tests_pri_-1000: 8 (3.0%), tests_pri_-950: 1.66 (0.6%), tests_pri_-900: 1.29 (0.5%), tests_pri_-400: 26 (10.0%), check_bayes: 25 (9.5%), b_tokenize: 10 (3.8%), b_tok_get_all: 7 (2.7%), b_comp_prob: 3.0 (1.1%), b_tok_touch_all: 2.8 (1.1%), b_finish: 0.63 (0.2%), tests_pri_0: 192 (73.0%), check_dkim_signature: 0.60 (0.2%), check_dkim_adsp: 8 (2.9%), tests_pri_500: 7 (2.7%), rewrite_mail: 0.00 (0.0%) Subject: Re: [REVIEW][PATCH 09/22] signal/nds32: 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Vincent Chen writes: > 2018-04-20 22:37 GMT+08:00 Eric W. Biederman : >> Filling in struct siginfo before calling force_sig_info a tedious and >> error prone process, where once in a great while the wrong fields >> are filled out, and siginfo has been inconsistently cleared. >> >> Simplify this process by using the helper force_sig_fault. Which >> takes as a parameters all of the information it needs, ensures >> all of the fiddly bits of filling in struct siginfo are done properly >> and then calls force_sig_info. >> >> In short about a 5 line reduction in code for every time force_sig_info >> is called, which makes the calling function clearer. >> >> Cc: Greentime Hu >> Cc: Vincent Chen >> Signed-off-by: "Eric W. Biederman" >> --- >> arch/nds32/kernel/traps.c | 20 ++++---------------- >> arch/nds32/mm/fault.c | 19 +++++-------------- >> 2 files changed, 9 insertions(+), 30 deletions(-) >> >> diff --git a/arch/nds32/kernel/traps.c b/arch/nds32/kernel/traps.c >> index 46911768f4b5..636d1c7aa895 100644 >> --- a/arch/nds32/kernel/traps.c >> +++ b/arch/nds32/kernel/traps.c >> @@ -222,20 +222,13 @@ void die_if_kernel(const char *str, struct pt_regs *regs, int err) >> >> int bad_syscall(int n, struct pt_regs *regs) >> { >> - siginfo_t info; >> - >> if (current->personality != PER_LINUX) { >> send_sig(SIGSEGV, current, 1); >> return regs->uregs[0]; >> } >> >> - clear_siginfo(&info); >> - info.si_signo = SIGILL; >> - info.si_errno = 0; >> - info.si_code = ILL_ILLTRP; >> - info.si_addr = (void __user *)instruction_pointer(regs) - 4; >> - >> - force_sig_info(SIGILL, &info, current); >> + force_sig_fault(SIGILL, ILL_ILLTRP, >> + (void __user *)instruction_pointer(regs) - 4, current); >> die_if_kernel("Oops - bad syscall", regs, n); >> return regs->uregs[0]; >> } >> @@ -288,16 +281,11 @@ void __init early_trap_init(void) >> void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, >> int error_code, int si_code) >> { >> - struct siginfo info; >> - >> tsk->thread.trap_no = ENTRY_DEBUG_RELATED; >> tsk->thread.error_code = error_code; >> >> - clear_siginfo(&info); >> - info.si_signo = SIGTRAP; >> - info.si_code = si_code; >> - info.si_addr = (void __user *)instruction_pointer(regs); >> - force_sig_info(SIGTRAP, &info, tsk); >> + force_sig_fault(SIGTRAP, si_code >> + (void __user *)instruction_pointer(regs), tsk); >> } >> > > I found a comma is missing after argument si_code. Good catch. Fixed. Unfortunately the only compiler I have for nds32 is my eyeballs so this slipped through. Grr. > Except the missing comma in send_sigtrap(), I think this patch for nds32 is OK. > I have corrected the change as you suggested and have added your Acked by. Eric