From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753823AbdGNLHS (ORCPT ); Fri, 14 Jul 2017 07:07:18 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:41867 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753472AbdGNLHO (ORCPT ); Fri, 14 Jul 2017 07:07:14 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Helge Deller Cc: linux-kernel@vger.kernel.org, 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 , Richard Henderson , Ivan Kokshaysky , Matt Turner , linux-alpha@vger.kernel.org References: <87efu22set.fsf@xmission.com> <20170630123906.8865-1-ebiederm@xmission.com> <20170702141320.GA32254@ls3530.fritz.box> Date: Fri, 14 Jul 2017 05:59:06 -0500 In-Reply-To: <20170702141320.GA32254@ls3530.fritz.box> (Helge Deller's message of "Sun, 2 Jul 2017 16:13:20 +0200") Message-ID: <87fudz5lol.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=1dVyR2-0002xv-NK;;;mid=<87fudz5lol.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=67.3.213.87;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+3lAK2IHvlbL7GU2jbdu8ZT7CuyxXPCVA= 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 * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 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=1] * 1.0 T_XMDrugObfuBody_08 obfuscated drug references * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa01 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ***;Helge Deller X-Spam-Relay-Country: X-Spam-Timing: total 5760 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 3.0 (0.1%), b_tie_ro: 2.1 (0.0%), parse: 1.45 (0.0%), extract_message_metadata: 38 (0.7%), get_uri_detail_list: 4.9 (0.1%), tests_pri_-1000: 21 (0.4%), tests_pri_-950: 1.98 (0.0%), tests_pri_-900: 1.74 (0.0%), tests_pri_-400: 51 (0.9%), check_bayes: 49 (0.8%), b_tokenize: 22 (0.4%), b_tok_get_all: 11 (0.2%), b_comp_prob: 6 (0.1%), b_tok_touch_all: 5 (0.1%), b_finish: 0.79 (0.0%), tests_pri_0: 1156 (20.1%), check_dkim_signature: 1.11 (0.0%), check_dkim_adsp: 4.1 (0.1%), tests_pri_500: 4481 (77.8%), poll_dns_idle: 4472 (77.6%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 1/8] signal/alpha: Document a conflict with SI_USER for SIGTRAP 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 List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Helge Deller writes: > * Eric W. Biederman : >> 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 alpha 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. > > The ABI was already broken, so IMHO I think it's better to somehow "fix" > it instead. Agreed, alpha and some other architectures are already aged, > but nevertheless most of them build in debian-ports. Below is a > suggested fix which reuses/misuses other existing trap codes instead. The conflict with SI_USER is real. I don't know that we have any actual applications that are suffering. I simply don't have the architecture specific references handy to know in which cases the oddities will happen let alone test them. Plus at least for ia64 and alpha those architectures don't appear to be receiving updates for new syscalls, and no new hardware is being built so I don't know how much longer they will last. That is building for alpha gives: > CALL /home/eric/projects/linux/linux-exit-cleanups/scripts/checksyscalls.sh > :1239:2: warning: #warning syscall seccomp not implemented [-Wcpp] > :1248:2: warning: #warning syscall bpf not implemented [-Wcpp] > :1299:2: warning: #warning syscall userfaultfd not implemented [-Wcpp] > :1302:2: warning: #warning syscall membarrier not implemented [-Wcpp] > :1305:2: warning: #warning syscall mlock2 not implemented [-Wcpp] > :1308:2: warning: #warning syscall copy_file_range not implemented [-Wcpp] > :1311:2: warning: #warning syscall preadv2 not implemented [-Wcpp] > :1314:2: warning: #warning syscall pwritev2 not implemented [-Wcpp] > :1317:2: warning: #warning syscall pkey_mprotect not implemented [-Wcpp] > :1320:2: warning: #warning syscall pkey_alloc not implemented [-Wcpp] > :1323:2: warning: #warning syscall pkey_free not implemented [-Wcpp] > :1326:2: warning: #warning syscall statx not implemented [-Wcpp] But a real fix like you have shown if you can get it approved by the alpha architecture maintainers I am more than happy to see, and would very much prefer. You certainly noticed that the middle case was SIGFPE when I missed that. Unfortunately I don't currently have the competence to judge the effects of your patch. Eric > Helge > > Signed-off-by: Helge Deller > > diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c > index 65bb102..2ed37dd 100644 > --- a/arch/alpha/kernel/traps.c > +++ b/arch/alpha/kernel/traps.c > @@ -278,7 +278,7 @@ do_entIF(unsigned long type, struct pt_regs *regs) > case 1: /* bugcheck */ > info.si_signo = SIGTRAP; > info.si_errno = 0; > - info.si_code = __SI_FAULT; > + info.si_code = TRAP_HWBKPT; > info.si_addr = (void __user *) regs->pc; > info.si_trapno = 0; > send_sig_info(SIGTRAP, &info, current); > @@ -318,7 +318,7 @@ do_entIF(unsigned long type, struct pt_regs *regs) > break; > case GEN_ROPRAND: > signo = SIGFPE; > - code = __SI_FAULT; > + code = FPE_FLTSUB; > break; > > case GEN_DECOVF: > @@ -340,7 +340,7 @@ do_entIF(unsigned long type, struct pt_regs *regs) > case GEN_SUBRNG7: > default: > signo = SIGTRAP; > - code = __SI_FAULT; > + code = TRAP_HWBKPT; > break; > } > From mboxrd@z Thu Jan 1 00:00:00 1970 From: ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman) Subject: Re: [PATCH 1/8] signal/alpha: Document a conflict with SI_USER for SIGTRAP Date: Fri, 14 Jul 2017 05:59:06 -0500 Message-ID: <87fudz5lol.fsf@xmission.com> References: <87efu22set.fsf@xmission.com> <20170630123906.8865-1-ebiederm@xmission.com> <20170702141320.GA32254@ls3530.fritz.box> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: <20170702141320.GA32254-PwtjyNU/e7vkVFMGpb/cPg@public.gmane.org> (Helge Deller's message of "Sun, 2 Jul 2017 16:13:20 +0200") Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Helge Deller Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, 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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Linux Containers , Michael Kerrisk , Richard Henderson , Ivan Kokshaysky , Matt Turner List-Id: linux-api@vger.kernel.org Helge Deller writes: > * Eric W. Biederman : >> 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 alpha 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. > > The ABI was already broken, so IMHO I think it's better to somehow "fix" > it instead. Agreed, alpha and some other architectures are already aged, > but nevertheless most of them build in debian-ports. Below is a > suggested fix which reuses/misuses other existing trap codes instead. The conflict with SI_USER is real. I don't know that we have any actual applications that are suffering. I simply don't have the architecture specific references handy to know in which cases the oddities will happen let alone test them. Plus at least for ia64 and alpha those architectures don't appear to be receiving updates for new syscalls, and no new hardware is being built so I don't know how much longer they will last. That is building for alpha gives: > CALL /home/eric/projects/linux/linux-exit-cleanups/scripts/checksyscalls.sh > :1239:2: warning: #warning syscall seccomp not implemented [-Wcpp] > :1248:2: warning: #warning syscall bpf not implemented [-Wcpp] > :1299:2: warning: #warning syscall userfaultfd not implemented [-Wcpp] > :1302:2: warning: #warning syscall membarrier not implemented [-Wcpp] > :1305:2: warning: #warning syscall mlock2 not implemented [-Wcpp] > :1308:2: warning: #warning syscall copy_file_range not implemented [-Wcpp] > :1311:2: warning: #warning syscall preadv2 not implemented [-Wcpp] > :1314:2: warning: #warning syscall pwritev2 not implemented [-Wcpp] > :1317:2: warning: #warning syscall pkey_mprotect not implemented [-Wcpp] > :1320:2: warning: #warning syscall pkey_alloc not implemented [-Wcpp] > :1323:2: warning: #warning syscall pkey_free not implemented [-Wcpp] > :1326:2: warning: #warning syscall statx not implemented [-Wcpp] But a real fix like you have shown if you can get it approved by the alpha architecture maintainers I am more than happy to see, and would very much prefer. You certainly noticed that the middle case was SIGFPE when I missed that. Unfortunately I don't currently have the competence to judge the effects of your patch. Eric > Helge > > Signed-off-by: Helge Deller > > diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c > index 65bb102..2ed37dd 100644 > --- a/arch/alpha/kernel/traps.c > +++ b/arch/alpha/kernel/traps.c > @@ -278,7 +278,7 @@ do_entIF(unsigned long type, struct pt_regs *regs) > case 1: /* bugcheck */ > info.si_signo = SIGTRAP; > info.si_errno = 0; > - info.si_code = __SI_FAULT; > + info.si_code = TRAP_HWBKPT; > info.si_addr = (void __user *) regs->pc; > info.si_trapno = 0; > send_sig_info(SIGTRAP, &info, current); > @@ -318,7 +318,7 @@ do_entIF(unsigned long type, struct pt_regs *regs) > break; > case GEN_ROPRAND: > signo = SIGFPE; > - code = __SI_FAULT; > + code = FPE_FLTSUB; > break; > > case GEN_DECOVF: > @@ -340,7 +340,7 @@ do_entIF(unsigned long type, struct pt_regs *regs) > case GEN_SUBRNG7: > default: > signo = SIGTRAP; > - code = __SI_FAULT; > + code = TRAP_HWBKPT; > break; > } >