Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751848AbdGROQB (ORCPT ); Tue, 18 Jul 2017 10:16:01 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:37576 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751715AbdGROP4 (ORCPT ); Tue, 18 Jul 2017 10:15:56 -0400 From: "Eric W. Biederman" To: linux-kernel@vger.kernel.org Cc: Andy Lutomirski , Linus Torvalds , Al Viro , Oleg Nesterov , Andrei Vagin , Thomas Gleixner , Greg KH , Andrey Vagin , Serge Hallyn , Pavel Emelyanov , Cyrill Gorcunov , Peter Zijlstra , Willy Tarreau , linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Linux Containers , Michael Kerrisk , "Eric W. Biederman" , Tony Luck , Fenghua Yu , linux-ia64@vger.kernel.org Date: Tue, 18 Jul 2017 09:06:46 -0500 Message-Id: <20170718140651.15973-2-ebiederm@xmission.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <87o9shg7t7.fsf_-_@xmission.com> References: <87o9shg7t7.fsf_-_@xmission.com> X-XM-SPF: eid=1dXTHx-0000EH-NS;;;mid=<20170718140651.15973-2-ebiederm@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=67.3.213.87;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18WZ/zAh7OW5bQhtY578GLCuRcLcYNbONg= X-SA-Exim-Connect-IP: 67.3.213.87 X-SA-Exim-Mail-From: ebiederm@xmission.com 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 * 0.0 TVD_RCVD_IP Message was received from an IP address * 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 * [sa01 1397; Body=1 Fuz1=1 Fuz2=41] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa01 1397; Body=1 Fuz1=1 Fuz2=41 X-Spam-Combo: **;linux-kernel@vger.kernel.org X-Spam-Relay-Country: X-Spam-Timing: total 5730 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 4.9 (0.1%), b_tie_ro: 3.9 (0.1%), parse: 1.44 (0.0%), extract_message_metadata: 57 (1.0%), get_uri_detail_list: 3.5 (0.1%), tests_pri_-1000: 27 (0.5%), tests_pri_-950: 2.0 (0.0%), tests_pri_-900: 1.79 (0.0%), tests_pri_-400: 77 (1.3%), check_bayes: 75 (1.3%), b_tokenize: 31 (0.5%), b_tok_get_all: 23 (0.4%), b_comp_prob: 4.6 (0.1%), b_tok_touch_all: 3.0 (0.1%), b_finish: 0.81 (0.0%), tests_pri_0: 827 (14.4%), check_dkim_signature: 0.93 (0.0%), check_dkim_adsp: 5.0 (0.1%), tests_pri_500: 4713 (82.3%), poll_dns_idle: 4700 (82.0%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH 2/7] signal/ia64: Document a conflict with SI_USER with 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 List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2438 Lines: 60 Setting si_code to __SI_FAULT results in a userspace seeing an si_code of 0. This is the same si_code as SI_USER. Posix and common sense requires that SI_USER not be a signal specific si_code. As such this use of 0 for the si_code is a pretty horribly broken ABI. Given that ia64 is on it's last legs I don't know that it is worth fixing this, but it is worth documenting what is going on so that no one decides to copy this bad decision. This was introduced in 2.3.51 so this mess has had a long time for people to be able to start depending on it. Cc: Tony Luck Cc: Fenghua Yu Cc: linux-ia64@vger.kernel.org Signed-off-by: "Eric W. Biederman" --- arch/ia64/include/uapi/asm/siginfo.h | 3 +++ arch/ia64/kernel/traps.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/ia64/include/uapi/asm/siginfo.h b/arch/ia64/include/uapi/asm/siginfo.h index 4694c64252d6..3282f8b992fc 100644 --- a/arch/ia64/include/uapi/asm/siginfo.h +++ b/arch/ia64/include/uapi/asm/siginfo.h @@ -107,6 +107,9 @@ typedef struct siginfo { /* * SIGFPE si_codes */ +#ifdef __KERNEL__ +#define FPE_FIXME (__SI_FAULT|0) /* Broken dup of SI_USER */ +#endif /* __KERNEL__ */ #define __FPE_DECOVF (__SI_FAULT|9) /* decimal overflow */ #define __FPE_DECDIV (__SI_FAULT|10) /* decimal division by zero */ #define __FPE_DECERR (__SI_FAULT|11) /* packed decimal error */ diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c index 7b1fe9462158..3cb17cf9b362 100644 --- a/arch/ia64/kernel/traps.c +++ b/arch/ia64/kernel/traps.c @@ -349,7 +349,7 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr) } siginfo.si_signo = SIGFPE; siginfo.si_errno = 0; - siginfo.si_code = __SI_FAULT; /* default code */ + siginfo.si_code = FPE_FIXME; /* default code */ siginfo.si_addr = (void __user *) (regs->cr_iip + ia64_psr(regs)->ri); if (isr & 0x11) { siginfo.si_code = FPE_FLTINV; @@ -373,7 +373,7 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr) /* raise exception */ siginfo.si_signo = SIGFPE; siginfo.si_errno = 0; - siginfo.si_code = __SI_FAULT; /* default code */ + siginfo.si_code = FPE_FIXME; /* default code */ siginfo.si_addr = (void __user *) (regs->cr_iip + ia64_psr(regs)->ri); if (isr & 0x880) { siginfo.si_code = FPE_FLTOVF; -- 2.10.1