Received: by 10.192.165.148 with SMTP id m20csp146751imm; Thu, 19 Apr 2018 18:11:37 -0700 (PDT) X-Google-Smtp-Source: AIpwx49k/ddEQIqmSiAy5W44w+z8ye2+lEqqHli/12g6NfOnVt7AdyBUNpeQYbix7RkwAPbif7oA X-Received: by 2002:a17:902:ac83:: with SMTP id h3-v6mr8263746plr.259.1524186697140; Thu, 19 Apr 2018 18:11:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524186697; cv=none; d=google.com; s=arc-20160816; b=HhpGWhqBCkR6EFs0v0TkLKVlF1hWcrLFASCxZvS2cByy11PsFtJeIVJhHzkL8vTqUp Sx36XXVfbQRmqa4T3lZixc9wxi0CQ5IncrOnXxTYP57g3lDM9NTC9Xj4Z1QvHK096PZx T5yXVMHYr54mm9FV0zxEgpniPfGteaAd3ljU3T/eRvZ4heja3VO7f1JNGUUVKptg+UGZ qIxyfVlLZDYriZof3n/ZsG7kqeDCSlnfQILUfDn4scAOqGn+SNJjcfUumsLdyBbNF4A9 93dCrf0UVBknDfW7YlwqbRBRnc+T/9tpgYu2jtrkMA6XVtqYzHdSjjSCuG3jxgn5ITgB jy+w== 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=HCQzlUN0wuYeWhjb4nsDZfZAizRP7oq7XY37YcSV4Vs=; b=lb34ecYL0QDrQfwp0Z4rmtPN3PU9ajuxgW2qsDFcbCie1ojpnppaNrU3bFgBKSiTgZ f88vq6PrRuG9uBerZdfZc5808/mRVuEqwg7uWRv2eOPUi/u4rzfY/5OqxlmhL79iWJNl Bv0pWKlGFLmmu2Giyttwgp3l89/Ch9UPgWS9DT+eGwMNZylQBGxx9k4j2XXuz4bzsLy5 nTxegA9QSmgTZAk/5dPP4D4B0d9uwHTQhOkv0BgZ7DKg0ta8L73aP5Gl3VnYTUbOhBlI GZ/4Ui0dvLJ+LWEcOmHLKFeU8wubDyrvwxpm51GbLAYG3EBNDUlPclIa50o+NwCN4spl JRzA== 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 s13-v6si4316935plp.102.2018.04.19.18.11.22; Thu, 19 Apr 2018 18:11:37 -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 S1754071AbeDTBGr (ORCPT + 99 others); Thu, 19 Apr 2018 21:06:47 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:50077 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753761AbeDTBGo (ORCPT ); Thu, 19 Apr 2018 21:06:44 -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 1f9KVe-0006lQ-1t; Thu, 19 Apr 2018 19:06:42 -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 1f9KVO-00014u-I5; Thu, 19 Apr 2018 19:06:41 -0600 From: "Eric W. Biederman" To: linux-arch@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, "Dmitry V. Levin" , David Miller , sparclinux@vger.kernel.org, "Eric W . Biederman" Date: Thu, 19 Apr 2018 20:03:53 -0500 Message-Id: <20180420010408.24438-2-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=1f9KVO-00014u-I5;;;mid=<20180420010408.24438-2-ebiederm@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=97.119.174.25;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+Bp/mkLY/hd/JB2fRH+gwyNpyh0/nTNPk= 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 sa07.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,XMNoVowels,XMSubLong autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 1.5 TR_Symld_Words too many words that have symbols inside * 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 * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ***;linux-arch@vger.kernel.org X-Spam-Relay-Country: X-Spam-Timing: total 15031 ms - load_scoreonly_sql: 0.04 (0.0%), signal_user_changed: 3.2 (0.0%), b_tie_ro: 2.3 (0.0%), parse: 0.75 (0.0%), extract_message_metadata: 18 (0.1%), get_uri_detail_list: 2.5 (0.0%), tests_pri_-1000: 2.8 (0.0%), tests_pri_-950: 1.25 (0.0%), tests_pri_-900: 0.97 (0.0%), tests_pri_-400: 23 (0.2%), check_bayes: 22 (0.1%), b_tokenize: 8 (0.1%), b_tok_get_all: 7 (0.0%), b_comp_prob: 1.96 (0.0%), b_tok_touch_all: 3.0 (0.0%), b_finish: 0.62 (0.0%), tests_pri_0: 188 (1.3%), check_dkim_signature: 0.47 (0.0%), check_dkim_adsp: 3.0 (0.0%), tests_pri_500: 14790 (98.4%), poll_dns_idle: 14778 (98.3%), rewrite_mail: 0.00 (0.0%) Subject: [REVIEW][PATCH 02/17] sparc: fix compat siginfo ABI regression 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 From: "Dmitry V. Levin" Starting with commit v4.14-rc1~60^2^2~1, a SIGFPE signal sent via kill results to wrong values in si_pid and si_uid fields of compat siginfo_t. This happens due to FPE_FIXME being defined to 0 for sparc, and at the same time siginfo_layout() introduced by the same commit returns SIL_FAULT for SIGFPE if si_code == SI_USER and FPE_FIXME is defined to 0. Fix this regression by removing FPE_FIXME macro and changing all its users to assign FPE_FLTUNK to si_code instead of FPE_FIXME. Note that FPE_FLTUNK is a new macro introduced by commit 266da65e9156d93e1126e185259a4aae68188d0e. Tested with commit v4.16-11958-g16e205cf42da. This bug was found by strace test suite. In the discussion about FPE_FLTUNK on sparc David Miller said: > Eric, feel free to do something similar on Sparc. Link: https://github.com/strace/strace/issues/21 Fixes: cc731525f26a ("signal: Remove kernel interal si_code magic") Fixes: 2.3.41 Cc: David Miller Cc: sparclinux@vger.kernel.org Conceptually-Acked-By: David Miller Thanks-to: Anatoly Pugachev Signed-off-by: Dmitry V. Levin Signed-off-by: Eric W. Biederman --- arch/sparc/include/uapi/asm/siginfo.h | 7 ------- arch/sparc/kernel/traps_32.c | 2 +- arch/sparc/kernel/traps_64.c | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/arch/sparc/include/uapi/asm/siginfo.h b/arch/sparc/include/uapi/asm/siginfo.h index 896ce447d16a..e7049550ac82 100644 --- a/arch/sparc/include/uapi/asm/siginfo.h +++ b/arch/sparc/include/uapi/asm/siginfo.h @@ -17,13 +17,6 @@ #define SI_NOINFO 32767 /* no information in siginfo_t */ -/* - * SIGFPE si_codes - */ -#ifdef __KERNEL__ -#define FPE_FIXME 0 /* Broken dup of SI_USER */ -#endif /* __KERNEL__ */ - /* * SIGEMT si_codes */ diff --git a/arch/sparc/kernel/traps_32.c b/arch/sparc/kernel/traps_32.c index b1ed763e4787..33cd35bf3dc8 100644 --- a/arch/sparc/kernel/traps_32.c +++ b/arch/sparc/kernel/traps_32.c @@ -307,7 +307,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc, info.si_errno = 0; info.si_addr = (void __user *)pc; info.si_trapno = 0; - info.si_code = FPE_FIXME; + info.si_code = FPE_FLTUNK; if ((fsr & 0x1c000) == (1 << 14)) { if (fsr & 0x10) info.si_code = FPE_FLTINV; diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c index 462a21abd105..e81072ac52c3 100644 --- a/arch/sparc/kernel/traps_64.c +++ b/arch/sparc/kernel/traps_64.c @@ -2372,7 +2372,7 @@ static void do_fpe_common(struct pt_regs *regs) info.si_errno = 0; info.si_addr = (void __user *)regs->tpc; info.si_trapno = 0; - info.si_code = FPE_FIXME; + info.si_code = FPE_FLTUNK; if ((fsr & 0x1c000) == (1 << 14)) { if (fsr & 0x10) info.si_code = FPE_FLTINV; -- 2.14.1