Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751934AbdGBOPP (ORCPT ); Sun, 2 Jul 2017 10:15:15 -0400 Received: from mout.gmx.net ([212.227.15.15]:63691 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750818AbdGBOPM (ORCPT ); Sun, 2 Jul 2017 10:15:12 -0400 Date: Sun, 2 Jul 2017 16:13:20 +0200 From: Helge Deller To: "Eric W. Biederman" 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 Subject: Re: [PATCH 1/8] signal/alpha: Document a conflict with SI_USER for SIGTRAP Message-ID: <20170702141320.GA32254@ls3530.fritz.box> References: <87efu22set.fsf@xmission.com> <20170630123906.8865-1-ebiederm@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170630123906.8865-1-ebiederm@xmission.com> User-Agent: Mutt/1.8.0 (2017-02-23) X-Provags-ID: V03:K0:BCgrguVAnGe96dCHuvlRkdVRMD6ZX49gm2SnDfVyR8t2AjVsx4k vFfgqenESj3/JoL7hszq/D36bEwY1EUn3TUhz5i3in2njMCjahu4KXSUuiIM/kuXZL6vxUz /IzdWsVlbGGnwhBiGYHxtB2hNPGx+X2mX9sevjIW32dyWrnDOND2CTDjcK2q9utMB2Z7ZTf nQkRoVypok/uMRgpIDhtA== X-UI-Out-Filterresults: notjunk:1;V01:K0:+frZtA1h+LM=:X36gIxzbVBYRXElD90g2E/ ezn6TSdH185fCnPp6fU+IDfseazqR0copV3G7kvkq8zXiUF6YhtQpagQOLCy8L4bzFqqk9J0J EiydctsHQrK8yLQbZ/lW5uB846mv3c9ewvSD+5KlKCFeAhAPmMpys1g8TVXfVXyFYtmaONV50 yO+kQjMNVypWeg0fIi9NVh0i5RmcPwDGAXMni+TUYD4mPxtgJBUPDl3rHjVSSxMmtCM/plQZi +MCC+A7CCI0ndasVUm4Vhqi6H2TTHvYlw6X5b1aJxRCN4tALgsAyXAXNbsO7OMYe9K0zK7g5x /GV6jWNogmfOI/Ih4/8ayByQwGva2QYCGKdsgjDBt31V02/9AJs30D894HhM0qrn6VQM4NJU9 YXL1SiW2KFe0ZzY3iZnUDMQjGct87UNLHe1HHnKNoPxGR9EjJ5W+dvWD/BFznSgF9tc3gS/Wa teozUvbOY4/OIORQRCARCGOhqfZVGg/bt/WANVJ9zLGhN0aKCe7AVzEHeEcDVQUfIbUm69jIK 74RYUA0qRkGQRB/AN09vjggZ+C+U6mE/sI8yq4i+NQvOF+EtgqSx6tjSGfpoJiw2YAzYqvU61 S5g7mpxagN38M7TFvJh1YwLvtF+pPp97GyOxmh3bhPrU4wKHzLCGbtI6wShBOi3xB9nXTNvG/ qqV++Rk2SGgiVek03hQhnBfkqo5CaFwqFeeGlXJirDJ9xsL+INwROLOXSqUVQGsNt9Abk/d2w WpjuMtmQJgxQ2NVartjz1WmHyPg1X59/PppNuMnrVMjwDCxTaGCIgmkpYsc= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1719 Lines: 52 * 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. 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; }