Received: by 10.192.165.148 with SMTP id m20csp149121imm; Thu, 19 Apr 2018 18:14:52 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Zgxge30xOyXnWNtbSJ9E+vyoFtmq1Xs/gv39asw0ZYUN3ohgS0Ed0fN5+69d/DGjutM37 X-Received: by 2002:a17:902:9686:: with SMTP id n6-v6mr7942643plp.136.1524186892089; Thu, 19 Apr 2018 18:14:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524186892; cv=none; d=google.com; s=arc-20160816; b=KwcaFpmlVcUsZmZRbdJTHHnKYqY4BAD8ZrEJwaYbd4xCYR4NUGIyUp9FZ/Jzb1GJjC hIhDSdWorl1C8zEVy5ZyPb7moh4bC9KUpDuP3R81YGibZO4LpPD06Tx8t9TwMcqjJgTu ru+zAXl0fxYekQkehZA9LoJSoIwfGToYFowOIxzPX7NQ3t42s9TjPcTUtQVg2Kcv1+V2 bY+L8mvRCxywW2BQzqZZRi3rrN1Y3zBeyxWslZoXwqnqP9ICudG6PxokVWV04Y0QLe1C pWefd6HGpfg4/Hx0pq1yDVTsk4iVvSupKzr4ZENZ+7TRqbZWj+XAafLL0Goa41zTLDZt XKaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=UYk3OTr0vbhKu6y7LFqWWmClAReFANY/lJoSfn3h9Ow=; b=Mu4/+60YwM63sEfm4cyM1vrmltpxuiORss2pwiif1ZmDFiMhpRqX2jQyML+EABc34X a8c2gpfX7Q1zwSSV8mSfVki+GrYWTKVbG+jCrrFHiPT8XVWZzG65ks06ld01w8IxLi+C hW/MP3bcNlssKmhLdsGzdFkMvcsw5+/fluwdZNeSwwNJLtIbEio9DzApBj7UUTN55j/J slRT+r4L/N7y8p6MmBz9Vdk+HtNGzpfLKnlMravEWrgD2YmTM5gg8T3FTxEa9rQKr/yg ExqEv0aCDj6yHpHCRzU6+uFKcWlJ0YDUnwTg59RFztZK2szLwkl5fP9eUJ3vug2UR+v9 QZbw== 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 3-v6si4579410plr.440.2018.04.19.18.14.38; Thu, 19 Apr 2018 18:14:52 -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 S1754101AbeDTBMR (ORCPT + 99 others); Thu, 19 Apr 2018 21:12:17 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:50408 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753782AbeDTBMI (ORCPT ); Thu, 19 Apr 2018 21:12:08 -0400 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 1f9Kat-0007Cv-Qb; Thu, 19 Apr 2018 19:12:07 -0600 Received: from [97.119.174.25] (helo=x220.int.ebiederm.org) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1f9KXH-00014u-Dr; Thu, 19 Apr 2018 19:08:23 -0600 From: "Eric W. Biederman" To: linux-arch@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, "Eric W. Biederman" , Guan Xuetao , Arnd Bergmann Date: Thu, 19 Apr 2018 20:04:05 -0500 Message-Id: <20180420010408.24438-14-ebiederm@xmission.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <878t9ilmhv.fsf@xmission.com> References: <878t9ilmhv.fsf@xmission.com> X-XM-SPF: eid=1f9KXH-00014u-Dr;;;mid=<20180420010408.24438-14-ebiederm@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=97.119.174.25;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1/n1FeKmvx/QM+bYrcCjfCAHE1PECEB+cE= 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.5 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TR_Symld_Words,T_TM2_M_HEADER_IN_MSG,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 TR_Symld_Words too many words that have symbols inside * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 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.4880] * -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 X-Spam-DCC: XMission; sa05 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ***;linux-arch@vger.kernel.org X-Spam-Relay-Country: X-Spam-Timing: total 244 ms - load_scoreonly_sql: 0.04 (0.0%), signal_user_changed: 3.8 (1.5%), b_tie_ro: 2.5 (1.0%), parse: 1.28 (0.5%), extract_message_metadata: 26 (10.4%), get_uri_detail_list: 2.9 (1.2%), tests_pri_-1000: 14 (5.8%), tests_pri_-950: 1.62 (0.7%), tests_pri_-900: 1.26 (0.5%), tests_pri_-400: 24 (9.7%), check_bayes: 22 (9.2%), b_tokenize: 9 (3.6%), b_tok_get_all: 7 (2.8%), b_comp_prob: 2.4 (1.0%), b_tok_touch_all: 2.3 (0.9%), b_finish: 0.73 (0.3%), tests_pri_0: 161 (65.9%), check_dkim_signature: 0.55 (0.2%), check_dkim_adsp: 3.0 (1.2%), tests_pri_500: 8 (3.2%), rewrite_mail: 0.00 (0.0%) Subject: [REVIEW][PATCH 14/17] signal/unicore32: Use FPE_FLTUNK instead of 0 in ucf64_raise_sigfpe 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 The si_code of 0 (aka SI_USER) has fields si_pid and si_uid not si_addr so it so only by luck would the appropriate fields by copied to userspace by copy_siginfo_to_user. This is just broken and wrong. Make it obvious what is happening by moving the si_code from a parameter of the one call to ucf64_raise_sigfpe to a constant value that info.si_code gets set to. Explicitly set the si_code to FPE_FLTUNK the newly reserved floating point si_code for an unknown floating point exception. It looks like there is a fair chance that this is a code path that has never been used in real life on unicore32. The bad si_code and the print statement that calls it an unhandled exception. So I really don't expect anyone will mind if this just gets fixed. In similar situations on more popular architectures the conclusion was just fix it. Cc: Guan Xuetao Cc: Arnd Bergmann Fixes: d9bc15794d12 ("unicore32 additional architecture files: float point handling") Signed-off-by: "Eric W. Biederman" --- arch/unicore32/kernel/fpu-ucf64.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/unicore32/kernel/fpu-ucf64.c b/arch/unicore32/kernel/fpu-ucf64.c index d785955e1c29..8594b168f25e 100644 --- a/arch/unicore32/kernel/fpu-ucf64.c +++ b/arch/unicore32/kernel/fpu-ucf64.c @@ -52,14 +52,14 @@ * Raise a SIGFPE for the current process. * sicode describes the signal being raised. */ -void ucf64_raise_sigfpe(unsigned int sicode, struct pt_regs *regs) +void ucf64_raise_sigfpe(struct pt_regs *regs) { siginfo_t info; clear_siginfo(&info); info.si_signo = SIGFPE; - info.si_code = sicode; + info.si_code = FPE_FLTUNK; info.si_addr = (void __user *)(instruction_pointer(regs) - 4); /* @@ -94,7 +94,7 @@ void ucf64_exchandler(u32 inst, u32 fpexc, struct pt_regs *regs) pr_debug("UniCore-F64 FPSCR 0x%08x INST 0x%08x\n", cff(FPSCR), inst); - ucf64_raise_sigfpe(0, regs); + ucf64_raise_sigfpe(regs); return; } -- 2.14.1