Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2437830imm; Thu, 27 Sep 2018 12:53:19 -0700 (PDT) X-Google-Smtp-Source: ACcGV61u9tYS4h6IZ5UxHo+T8RFvNhF3mohFs+1cStEPP3jxoxdfcWdbAaP6MM4CNmoTKpkvowkR X-Received: by 2002:a63:7744:: with SMTP id s65-v6mr11823611pgc.197.1538077999837; Thu, 27 Sep 2018 12:53:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538077999; cv=none; d=google.com; s=arc-20160816; b=Z9sPcJgw5CVE3jxZuOytQ1kUjASPmxmkMdFwO9TN8fcDlJJfPqJ5FcE1ZlmS6aQE0f +b9K2SrhK5cBUlUYH6poUUNPKJO/XDCJRVjx9Kr8jo8kdk9fhMQAwDXHk4Ai3eSdyBbW DcBTLj11c/rTLQnDA8HSm1jj+Kzl4Mw8BymrjlDTZqrmfoBwqdAOwFjH9IdsMT4b5Z6h 29PQwf/DDXczC34xDld8vKMWmv8wX5TuKEK7DrDGqSchMinQVUyCWBi4rQuaAQZ7jE5/ uLLBY1Txl1F9RE9iGPPml8vPNyvLvMgPkIJn2BEGd9Ja7++Vy3HP2sFSWUNBYDvU6JK3 eWlQ== 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; bh=wUpRvuO02OhndLghwP+xqGAeb0HceC+BdP3UxQEljIU=; b=MK+cxAx8yQs1+934WEFoyKKq0IYjwHGSXYjy9hQfb2wqkdcKs9jm+QT/tY5V44P9O0 eNNXxMi9o258L+SMun5ZA7+ldj9nRD6zdqnIY8D2xiApmke0DbsBxQ2AF3kEBTYUAH3u 97eDgO3agLH8gI9/4qrMCoqP0mVcm6EYlkFk8EK+52qXsqziKZvx/M5t99aLfcrmzlfF KFLhMVbQpQDjjEtD7yVJ9fVnwdFuBZg0uK0XaMidqpcxi1jI0xhACKBor9HJlT72q34U oxdyujcTzmV/Xk/l25RdpqsoLywwVPFTGPl4ddcZ3osUtpKDJAyCZa1k1gO8+YpOae+y 4zbA== 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 l18-v6si2874559pfk.78.2018.09.27.12.53.03; Thu, 27 Sep 2018 12:53:19 -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 S1727528AbeI1CLE (ORCPT + 99 others); Thu, 27 Sep 2018 22:11:04 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:43756 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727294AbeI1CLD (ORCPT ); Thu, 27 Sep 2018 22:11:03 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out01.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1g5cJX-0002Ex-25; Thu, 27 Sep 2018 13:51:07 -0600 Received: from [105.184.227.67] (helo=x220.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1g5cJV-0000p3-OT; Thu, 27 Sep 2018 13:51:06 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Guo Ren Cc: akpm@linux-foundation.org, arnd@arndb.de, daniel.lezcano@linaro.org, davem@davemloft.net, gregkh@linuxfoundation.org, jason@lakedaemon.net, marc.zyngier@arm.com, mark.rutland@arm.com, mchehab+samsung@kernel.org, peterz@infradead.org, robh@kernel.org, robh+dt@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, devicetree@vger.kernel.org, green.hu@gmail.com References: Date: Thu, 27 Sep 2018 21:50:43 +0200 In-Reply-To: (Guo Ren's message of "Thu, 27 Sep 2018 22:47:45 +0800") Message-ID: <87h8iaoh2k.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=1g5cJV-0000p3-OT;;;mid=<87h8iaoh2k.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=105.184.227.67;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX19TbJoKn4uEMJ7mg2tvxEMUWeDMNfSGgd0= 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=-0.2 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,T_TM2_M_HEADER_IN_MSG autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4505] * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Guo Ren X-Spam-Relay-Country: X-Spam-Timing: total 279 ms - load_scoreonly_sql: 0.04 (0.0%), signal_user_changed: 3.4 (1.2%), b_tie_ro: 2.3 (0.8%), parse: 1.03 (0.4%), extract_message_metadata: 12 (4.1%), get_uri_detail_list: 1.44 (0.5%), tests_pri_-1000: 6 (2.0%), tests_pri_-950: 1.35 (0.5%), tests_pri_-900: 1.16 (0.4%), tests_pri_-400: 22 (8.0%), check_bayes: 21 (7.5%), b_tokenize: 7 (2.7%), b_tok_get_all: 7 (2.4%), b_comp_prob: 1.98 (0.7%), b_tok_touch_all: 2.4 (0.9%), b_finish: 0.71 (0.3%), tests_pri_-100: 6 (2.0%), check_dkim_signature: 0.64 (0.2%), check_dkim_adsp: 2.8 (1.0%), tests_pri_0: 206 (73.9%), tests_pri_10: 3.1 (1.1%), tests_pri_500: 14 (5.0%), poll_dns_idle: 0.11 (0.0%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH V6 08/33] csky: Process management and Signal 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 in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Guo Ren writes: > --- /dev/null > +++ b/arch/csky/abiv2/fpu.c > +void fpu_fpe(struct pt_regs * regs) > +{ > + int sig; > + unsigned int fesr; > + siginfo_t info; > + > + fesr = mfcr("cr<2, 2>"); > + > + if(fesr & FPE_ILLE){ > + info.si_code = ILL_ILLOPC; > + sig = SIGILL; > + } > + else if(fesr & FPE_IDC){ > + info.si_code = ILL_ILLOPN; > + sig = SIGILL; > + } > + else if(fesr & FPE_FEC){ > + sig = SIGFPE; > + if(fesr & FPE_IOC){ > + info.si_code = FPE_FLTINV; > + } > + else if(fesr & FPE_DZC){ > + info.si_code = FPE_FLTDIV; > + } > + else if(fesr & FPE_UFC){ > + info.si_code = FPE_FLTUND; > + } > + else if(fesr & FPE_OFC){ > + info.si_code = FPE_FLTOVF; > + } > + else if(fesr & FPE_IXC){ > + info.si_code = FPE_FLTRES; > + } > + else { > + info.si_code = NSIGFPE; > + } > + } > + else { > + info.si_code = NSIGFPE; > + sig = SIGFPE; > + } > + info.si_signo = SIGFPE; > + info.si_errno = 0; > + info.si_addr = (void *)regs->pc; > + force_sig_info(sig, &info, current); > +} This use of sending a signal is buggy. It results in undefined values being copied to userspace. Userspace should never be sent NSIGXXX as a si_code. You can use FPE_FLTUNK for this default case. In new code please use force_sig_fault instead of force_sig_info in new code. That saves you the trouble of messing with struct siginfo. Thank you very much, Eric Biederman