From patchwork Mon Mar 19 15:56:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 10292735 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1DE35602C2 for ; Mon, 19 Mar 2018 15:57:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D12627E01 for ; Mon, 19 Mar 2018 15:57:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0165C283F2; Mon, 19 Mar 2018 15:57:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5734027E01 for ; Mon, 19 Mar 2018 15:57:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934601AbeCSP5d (ORCPT ); Mon, 19 Mar 2018 11:57:33 -0400 Received: from mail-cys01nam02on0135.outbound.protection.outlook.com ([104.47.37.135]:19273 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934683AbeCSP51 (ORCPT ); Mon, 19 Mar 2018 11:57:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7MOEwcO1LoLuSMyABa93Th3qwdSMb7lSSLRoSXteXPk=; b=KNkjUGAN9NA+J95EP7tsfD7AoyfHbbUunPyva99FDj17JxxEHW2O3340ZDgFb7MUvnhkCv+dkfy41LhmK/VK4uruiWqum0lWAROndicV8gHSUk/gEMK8yibMfsCONli8hj9kNc/NA406Ba2pi+BNjtXVb3ikCcSmyKMamQ1k76I= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1096.namprd21.prod.outlook.com (52.132.130.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 15:57:24 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 15:57:24 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: "Eric W. Biederman" , "James E.J. Bottomley" , Helge Deller , "linux-parisc@vger.kernel.org" , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 91/97] signal/parisc: Document a conflict with SI_USER with SIGFPE Thread-Topic: [PATCH AUTOSEL for 4.14 91/97] signal/parisc: Document a conflict with SI_USER with SIGFPE Thread-Index: AQHTv5rZFLWqFTWbW0ub1xZCmJNBCg== Date: Mon, 19 Mar 2018 15:56:31 +0000 Message-ID: <20180319155411.12348-91-alexander.levin@microsoft.com> References: <20180319155411.12348-1-alexander.levin@microsoft.com> In-Reply-To: <20180319155411.12348-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB1096; 7:xIbIf791jWL/gxb3kgs8FkvFp83DD2xaSXmacbNXJ2OZ6BIyZEZH6tHZKXkJmHOdW9aPzbVQjA4wA9bkTcZ0UMHeMmEzmQbWsWZLytBMfWS7dbPb15fjV47/eWyHjwd1A5jKgyxIA0w8ihI9dE6USQ6xmtUDzd7xsmM2R5/mrpLn/z5T2x5Dj/8ibgUdGwWFeOSuryQjWcVszNnzAEvRb1CKaNiDGvdKOWb85c6MSTRsu9uTKUlP4NsN/4dNfH0M; 20:ib9c1zsUv+XIB8RKnDo5Qq1HeQ0fEHzs5BQs4+CKBn4q//kbMYtB20x4BJNmXOAMkK8syWJi6lm9h+edzd2DPetkBjw9Y+PQ7m7V9GqFEikg94uB6Y6WhbTV2edDAxEqCq5hWqeepdekt8HV89oh8q4+bmxT0Eq+C1ihPUZSe44= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: f7d93174-4bbd-4dcb-78e5-08d58db21b76 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB1096; x-ms-traffictypediagnostic: DM5PR2101MB1096: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(26323138287068)(89211679590171)(9452136761055)(84791874153150); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR2101MB1096; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB1096; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(979002)(346002)(39860400002)(396003)(366004)(376002)(39380400002)(189003)(199004)(86612001)(316002)(26005)(72206003)(4326008)(25786009)(110136005)(10290500003)(966005)(86362001)(54906003)(575784001)(59450400001)(14454004)(53936002)(36756003)(107886003)(3280700002)(22452003)(6506007)(5660300001)(68736007)(186003)(99286004)(478600001)(76176011)(6666003)(10090500001)(102836004)(2950100002)(6116002)(5250100002)(2501003)(97736004)(3660700001)(106356001)(81156014)(81166006)(8936002)(8676002)(7736002)(305945005)(2900100001)(105586002)(3846002)(1076002)(2906002)(6436002)(66066001)(6306002)(6512007)(8666007)(6486002)(22906009)(217873001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB1096; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: yQYKq/NVYDRO38SBzTOt8KwCJdD5Y93OVclmVRb1TUaNW6YMkhOM8q2Sh3w7xArC2nCd2kV/F+9qy7Ji4lMuWb+15+hHKvp/Y1JjccrIQwwjz5vG+olJ78HsX20ncrT3dMyVj9STGCjVmqp1IV1rDOw44Q4iBf3brrQWOZCeDR0uKDUOFRTlbhhWRwRW6oUyfEiRDCJoknVnb3WGmGbQm9pAJsIUNJ1AbkPvwK9+wAqBWLBmMKv8VwnrVFiCPo2uvrLIe8kORJbMawSAemq+kCGm+mVdLNmg4G5AOVL/6qQR1613IHLE9ChpIGYe05mCZevsC5l/x96N/OhGwWy9PA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: f7d93174-4bbd-4dcb-78e5-08d58db21b76 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 15:56:31.7597 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1096 Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Eric W. Biederman" [ Upstream commit b5daf2b9d1c9a2b4f03ca93f75913ba2da3b3eaa ] Setting si_code to 0 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. Further use of si_code == 0 guaranteed that copy_siginfo_to_user saw a value of __SI_KILL and now sees a value of SIL_KILL with the result that uid and pid fields are copied and which might copying the si_addr field by accident but certainly not by design. Making this a very flakey implementation. Utilizing FPE_FIXME siginfo_layout will now return SIL_FAULT and the appropriate fields will reliably be copied. This bug is 13 years old and parsic machines are no longer being built so I don't know if it possible or worth fixing it. But it is at least worth documenting this so other architectures don't make the same mistake. Possible ABI fixes includee: - Send the signal without siginfo - Don't generate a signal - Possibly assign and use an appropriate si_code - Don't handle cases which can't happen Cc: "James E.J. Bottomley" Cc: Helge Deller Cc: linux-parisc@vger.kernel.org Ref: 313c01d3e3fd ("[PATCH] PA-RISC update for 2.6.0") Histroy Tree: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git Signed-off-by: "Eric W. Biederman" Signed-off-by: Sasha Levin --- arch/parisc/include/uapi/asm/siginfo.h | 7 +++++++ arch/parisc/kernel/traps.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/parisc/include/uapi/asm/siginfo.h b/arch/parisc/include/uapi/asm/siginfo.h index 4a1062e05aaf..be40331f757d 100644 --- a/arch/parisc/include/uapi/asm/siginfo.h +++ b/arch/parisc/include/uapi/asm/siginfo.h @@ -8,4 +8,11 @@ #include +/* + * SIGFPE si_codes + */ +#ifdef __KERNEL__ +#define FPE_FIXME 0 /* Broken dup of SI_USER */ +#endif /* __KERNEL__ */ + #endif diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c index 8453724b8009..c919e6c0a687 100644 --- a/arch/parisc/kernel/traps.c +++ b/arch/parisc/kernel/traps.c @@ -629,7 +629,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs) si.si_signo = SIGFPE; /* Set to zero, and let the userspace app figure it out from the insn pointed to by si_addr */ - si.si_code = 0; + si.si_code = FPE_FIXME; si.si_addr = (void __user *) regs->iaoq[0]; force_sig_info(SIGFPE, &si, current); return;