Received: by 10.213.65.68 with SMTP id h4csp1618670imn; Mon, 19 Mar 2018 08:54:25 -0700 (PDT) X-Google-Smtp-Source: AG47ELvB1ILAVVmXFQCw6UzH1b7qoKLs9pni28SBAEE21IJ5TL/cT3SEqh9KIWhwgdNwgLVRpXk7 X-Received: by 2002:a17:902:2f:: with SMTP id 44-v6mr13093125pla.187.1521474865448; Mon, 19 Mar 2018 08:54:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521474865; cv=none; d=google.com; s=arc-20160816; b=g9NBjiyaf1D9U7RgYeQOvBNVF2IqW277D+/4eWosPo0O4uLaBaNJ150X0TvAMdEpdc IRVWqiUE8u46N51OyAU6PAL16zRMcd9Breav97/xQCVAjTOvZfo24ij99jxxxclqlOun 3Eju7pCpvfQOITgPABgrx0Nxe7H48gKy3aiwesHjrmqLmiLew7l/qmAGPQ09kOKOca30 xbeox54YPtV4BXcc/TVtYa4WvHQys5lo4GcTB61iz/gZtAyV1HEGn0CHuLtZlpY7V+5i osu2J/RP2VWgJYsqR2TUIoh3t7ekA1e12WMFqMSB+tHXupDhCJf8b05AqCwfO+pI7O+Z mrSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=PqBE/HnjCjKCVygLsXfEFcZD+CorfOrg/iYfHDv+SlY=; b=ZyNUxJ9n8/wGAPzR+6o1mKh9Bvznhz50GjNdfNk7HLU8/rRbACKIdmUAUqtzkZvKk5 dHCjgPvv5wj4GhTuy9/3O6IQOHn52W8a5KgdFsilly7mG/7Tn2mJX3mirLdUBkzZB+/I cLauqgmjaKqbtvKmHGSjMgQAwMssV7GvNKjqmyz1LrCjErEaRkp1IE26rAxaJmoLR31c tPpoDoomOsrfN1uFm8TzKBD6tai0m0Vji50pVqkNEqaZHd15r3W9q/IqjytS0BzKtPIl 7UCzs5Bd0cjsZjqEFd935anSt++TLNkV75tnfBqvktc6cG8zNah4qjtVYv98kjRfCwIu jgDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=KaicXZt0; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v2-v6si212925plp.113.2018.03.19.08.54.10; Mon, 19 Mar 2018 08:54:25 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=KaicXZt0; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934191AbeCSPwP (ORCPT + 99 others); Mon, 19 Mar 2018 11:52:15 -0400 Received: from mail-by2nam01on0114.outbound.protection.outlook.com ([104.47.34.114]:57771 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934082AbeCSPuS (ORCPT ); Mon, 19 Mar 2018 11:50:18 -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=PqBE/HnjCjKCVygLsXfEFcZD+CorfOrg/iYfHDv+SlY=; b=KaicXZt0hoyH/B9wEsscnNtA+fWFpwlPrl+iB8N4y7Gt9pfdf7u1Dlbg/BDZh1VvXDXy3f/INi8JwxIa2PQ4xVWzd8FdU0K6BNtIL+X19G0VRtmF43c+yhXetaZgc35XfOSypZssESMU090XO+YsBrV2A6ZaR6zwGkmqoHc2+sQ= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1109.namprd21.prod.outlook.com (52.132.130.19) 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:50:06 +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:50:06 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: "Eric W. Biederman" , James Hogan , "linux-metag@vger.kernel.org" , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 119/124] signal/metag: Document a conflict with SI_USER with SIGFPE Thread-Topic: [PATCH AUTOSEL for 4.15 119/124] signal/metag: Document a conflict with SI_USER with SIGFPE Thread-Index: AQHTv5nVZHtOs4DFeku6AvjGr4uvOQ== Date: Mon, 19 Mar 2018 15:49:15 +0000 Message-ID: <20180319154645.11350-119-alexander.levin@microsoft.com> References: <20180319154645.11350-1-alexander.levin@microsoft.com> In-Reply-To: <20180319154645.11350-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;DM5PR2101MB1109;7:lDKkUVrl6k264MfuVNTRW3sLQK47xzUBaH87mJnWJzIUAembVmSqzi1iwJEC9fItX3durpOV/RkbtoBxEtYN7wvy1/RZvPS/VsXVRMF3SAdvDOLSJc3bGaIgZMEr0Q1jEYplNQY4TjuG/nvd8n+ciMs+9bnBvI1pN+zGEC8SEUacK4lGwPaiA9H+nOJ3ygJ9pyy5FpYthwvdk06sruYqrrrVe6fxEJMEpKZE1IIu6JNf4V/p6SQ2p3S0FEd22XWD;20:psHfSS3wkJtzMr/r8k9fiPHGB8Zkgnkg8ap6gd6woqAAHAGCpqPYSPLRpBvlqZgw32cvFjMsqEUpDj6kdfD7FBfbHa3ADW4GBKuGCaCgqPjyxFfO4rjZX0Iv1k4ZYv6m4fdCadOqHrLLYDIfjTY0XLW4rHdqMWp9UarwrZNHKXE= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 1fe5d7b6-e3a3-43a1-8707-08d58db11679 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1109; x-ms-traffictypediagnostic: DM5PR2101MB1109: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(9452136761055); 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:DM5PR2101MB1109;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1109; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(396003)(39860400002)(39380400002)(376002)(346002)(199004)(189003)(81166006)(10290500003)(107886003)(81156014)(106356001)(6506007)(8676002)(3846002)(36756003)(8936002)(97736004)(6116002)(1076002)(102836004)(68736007)(6666003)(3280700002)(2950100002)(3660700001)(478600001)(72206003)(59450400001)(2906002)(14454004)(76176011)(66066001)(6512007)(5250100002)(10090500001)(2501003)(53936002)(6486002)(6436002)(26005)(316002)(22452003)(305945005)(7736002)(4326008)(25786009)(86362001)(575784001)(86612001)(5660300001)(2900100001)(99286004)(54906003)(186003)(105586002)(110136005)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1109;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: XzyrFJo5Q7EBjIg7AWlefZV23Exz7PT24qhBECFhnHXfg8CThDipABLRc9yTcV/rBxNAsnLnxkxqUYLRPw29qFY6sWIlSw4G+sOizkYhfGriauF8sbF7xE4+yDShknxaeInagTwE8WNpkZfN99tFzOOZ31RPe6doNUexEt9N3JZGDnw0OrlTFpb2Z3hCQbgP7Sq5Ywr4a/rNyAPcUnhu4/CuqJNLCrVJAYH0LuNpFuuaqoS3VmWQuqReNchSMC+t73NGOTzUailNTNn7UHdyW+Wl15RmxE2YtZNuvixlceGpNTDNp1W/wZof9v4m2EXgaeBjpV1ekOLasSC5tNYPaA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1fe5d7b6-e3a3-43a1-8707-08d58db11679 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 15:49:15.6976 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1109 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Eric W. Biederman" [ Upstream commit b80328be53c215346b153769267b38f531d89b4f ] 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 =3D=3D 0 guaranteed that copy_siginfo_to_user saw a value of __SI_KILL and now sees a value of SIL_KILL with the result hat 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. 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 Hogan Cc: linux-metag@vger.kernel.org Ref: ac919f0883e5 ("metag: Traps") Signed-off-by: "Eric W. Biederman" Signed-off-by: Sasha Levin --- arch/metag/include/uapi/asm/siginfo.h | 7 +++++++ arch/metag/kernel/traps.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/metag/include/uapi/asm/siginfo.h b/arch/metag/include/uap= i/asm/siginfo.h index b54ef7186ca3..9a3f6cde9487 100644 --- a/arch/metag/include/uapi/asm/siginfo.h +++ b/arch/metag/include/uapi/asm/siginfo.h @@ -6,4 +6,11 @@ =20 #include =20 +/* + * SIGFPE si_codes + */ +#ifdef __KERNEL__ +#define FPE_FIXME 0 /* Broken dup of SI_USER */ +#endif /* __KERNEL__ */ + #endif diff --git a/arch/metag/kernel/traps.c b/arch/metag/kernel/traps.c index 444851e510d5..3b62b1b0c0b5 100644 --- a/arch/metag/kernel/traps.c +++ b/arch/metag/kernel/traps.c @@ -735,7 +735,7 @@ TBIRES fpe_handler(TBIRES State, int SigNum, int Trigge= rs, int Inst, PTBI pTBI) else if (error_state & TXSTAT_FPE_INEXACT_BIT) info.si_code =3D FPE_FLTRES; else - info.si_code =3D 0; + info.si_code =3D FPE_FIXME; info.si_errno =3D 0; info.si_addr =3D (__force void __user *)regs->ctx.CurrPC; force_sig_info(SIGFPE, &info, current); --=20 2.14.1