From patchwork Tue May 15 19:11:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 135927 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1427059lji; Tue, 15 May 2018 12:12:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpMmgEpCuB118nZD/GX/r4E8C98bSgWVdUKm9hGNaV+GC4bRXnpwipFOEwKJvR1KfbzDfYY X-Received: by 2002:a62:ec18:: with SMTP id k24-v6mr16456106pfh.204.1526411576533; Tue, 15 May 2018 12:12:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526411576; cv=none; d=google.com; s=arc-20160816; b=uAehIJHwmHAhrXpVEeuyVs/keuzXpfYDlx6YR/iD1GkGWM5cvBMgydw7/PCidGN9oH xTE42cUidIzR2M7VTmeOdTJ7FlF3xvVh6cxlSIARawb85gzTz/NEeYsR1Omum2cnsT5F 74nA0dN3doemMQ0Z/2HQ0WjKrx5aB8IPF5PwDZeC954O/ZoPze02kST50QdJrSYMC8Y/ XxEJZ51AJs0pMXmAZY9dlULsrtaNWIH1Ou16+3uj1Z6NZXJZZ/556uz2BIvVNiC7pZgz 4fik72dNkt88Opa1mN8USJGd66Z9eq6+b99xWaS1JllNV/U2+eq/zJUC/31RQZP7dAy/ dd0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=iE1ShwXT97gcw1DghG/7asN6tgL0zQ896B38HSzqzzg=; b=d4vqGNBUjNoUPCGoV9jRUXG8n8xk8c2GXSRst4pfpZrN8YnDo+hVu2TcRjNi3pPa57 bnmRBQ17w/742SLV+zVwTx6lgOzkiLRW183S7vUJ5CnhSalUtgSfjNdDAMHn9Ha5CKfy cACDrS9dzHAMM9k91xt9yJXj2bzU7h7wASNTDI6+7sDREt6hp0Bpb4WSLcRjktuGjJG1 VBzFnxMjUgoU/sRHTd1HKeeMxBL3ctcCDKbJHuB1cq4/J9gWZqAaFDhtc5bpUn8pcI2D Ss4Nqi4M14mG9zZcNTG93cLCKGhUT/ZWcGfdzDmX7yx0+XZSoyhH98Hi93leZopctmsu kvQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=VfRiTU1C; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z188-v6si657317pfz.335.2018.05.15.12.12.56; Tue, 15 May 2018 12:12:56 -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=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=VfRiTU1C; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752613AbeEOTMy (ORCPT + 29 others); Tue, 15 May 2018 15:12:54 -0400 Received: from mail-co1nam03on0054.outbound.protection.outlook.com ([104.47.40.54]:12800 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752500AbeEOTMu (ORCPT ); Tue, 15 May 2018 15:12:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iE1ShwXT97gcw1DghG/7asN6tgL0zQ896B38HSzqzzg=; b=VfRiTU1CxSDdfW4Wgewk0tMG+WkhVMudhVu+mwAX+uK6kyraun3w5I9e7fUJINpVC0JxkbyoI2qDBp4LMkiGfqylNXGV1u1rGvl1TRHC7m/ZZQO+ZpkgZlxUU9Nrl+OxywmzQmQYlz55gKh9FzKjcVjZCzLl33bIXipsJTrvW0o= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@cavium.com; Received: from localhost (176.59.40.107) by BYAPR07MB4375.namprd07.prod.outlook.com (2603:10b6:a02:c0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Tue, 15 May 2018 19:12:44 +0000 From: Yury Norov To: Catalin Marinas , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org Cc: Yury Norov , Adam Borowski , Alexander Graf , Alexey Klimov , Andreas Schwab , Andrew Pinski , Bamvor Zhangjian , Chris Metcalf , Christoph Muellner , Dave Martin , "David S . Miller" , Florian Weimer , Geert Uytterhoeven , Heiko Carstens , James Hogan , James Morse , Joseph Myers , Lin Yongting , Manuel Montezelo , Mark Brown , Martin Schwidefsky , Maxim Kuvyrkov , Nathan_Lynch , Philipp Tomsich , Prasun Kapoor , Ramana Radhakrishnan , Steve Ellcey , Szabolcs Nagy , Zhou Chengming Subject: [PATCH 01/24] arm64: signal: Make parse_user_sigframe() independent of rt_sigframe layout Date: Tue, 15 May 2018 22:11:51 +0300 Message-Id: <20180515191214.5045-2-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180515191214.5045-1-ynorov@caviumnetworks.com> References: <20180515191214.5045-1-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [176.59.40.107] X-ClientProxiedBy: HE1PR0301CA0001.eurprd03.prod.outlook.com (2603:10a6:3:76::11) To BYAPR07MB4375.namprd07.prod.outlook.com (2603:10b6:a02:c0::18) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BYAPR07MB4375; X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4375; 3:c5uUkIZ9NUluRijkLEW6hNMWjZbdCwe3UfTdQQSRDy1kT3L6xXx4AabVyIxOJtn/buCntxvEtPpZ6VTymTz5KJ6++6/dEZ36opeCYkxSx0fV6eUdqbgr6iW/9S/gGKuRUJmCwbALefZ4Z2Fq6lIc3tkD0ExMISm27JjfYRz+IjnB8yMRl3Qzayu+jC2K/EUfmouigTyva3CjsMiQRiZ5UCywRNUAsiyBz5Lm/7WOqiLXkXsYagnVozaxr9u1fSew; 25:AUooJOm9K3w6ijO4/2y9YefQV/Uhren3EZckSJazPof36+fgsGZPTMt7JzVAmbs+SUP2oGfiRtNoThvWWj6/We/y0xlrvpB9J0YkNi7Fe9Q8zV6M3iykBlE0Bs1/JGjt9bZPvPH9eRirlHxNVzdDgYT0Q5bIhMUkwlRL7pMu+26b5IY8pAytV4zGd814o8DPeMIS2GzSqYLkAXRuOhh490w3KtRwd69ChfydS12UyEs6H+cDR/IwJoGHi4vg8mN7wSodHqmh+hbWXQgn2Cvposcpnh0I5pzZLcAE+6jNnXAOGSvjOvWDYY8RIrA3QLYjYmo//bQS6AE+ubjdyWVUSg==; 31:3aEVzMhOnkGYoH4MvfCaVRrvRna8jZBA2Tim/Y1X5tpi9AVGh9kNKeLupH1j6Mg1303ug8CKJhW1bzqw1Eq1bAH4rwBh0O33rD5DD5b/lXUMY9/6Ian4Jsl3dj8wqDLXRS3GrCjJ0VBhetvbC+tSlz3EkpYSRIhUFu1MnNbC2BPzddWFVedRbd6xFB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RVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(93006095)(3231254)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:BYAPR07MB4375; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB4375; X-Forefront-PRVS: 0673F5BE31 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(366004)(396003)(376002)(346002)(39850400004)(39380400002)(189003)(199004)(6496006)(51416003)(2906002)(11346002)(446003)(52116002)(39060400002)(16586007)(47776003)(6666003)(42882007)(478600001)(25786009)(76176011)(97736004)(59450400001)(6486002)(53936002)(316002)(110136005)(50466002)(4326008)(48376002)(54906003)(66066001)(6116002)(3846002)(7406005)(7416002)(5660300001)(72206003)(8936002)(50226002)(81166006)(81156014)(8676002)(76506005)(7736002)(305945005)(26005)(486006)(186003)(105586002)(1076002)(106356001)(36756003)(16526019)(956004)(2616005)(476003)(68736007)(386003); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB4375; H:localhost; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4375; 23:l1TtueW9PhQCkd9+d28Tkh4M3jJaxUAjmFbrj8ktVDjgAhqjr880ogSdfmOqLm3VJEgAg1ybT1EvKYd7H5K9QfeO/P8lgQknpxbQL23Vgg7PV00/3UfvEzTUmP0k4Cn6Qwuqm1xwpRv/9hS9cQmBptoCTvX1g/yZF8cN6KtOBwZ33w1jVkiQbxfgk5m99mZ3N1VOJbiKipbivYhHKoRTDtdbEsW+K9EOiNtI2KlmCP2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Output: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4375; 7:nI5pDkPn64uVmr5JTzUPF/PtxaSlzR92Q7V3jN5UP8ggz4MtaeBmIUCz+06O8VLyC22z+P0e+fMaQdEPjAE1sl7XzXAYxsZpiSm21yl3qYKtf6DZMjb/t+oBUn3cNjZTWzOBzXj7YNdsgg0DINbjV2uU9vl83CqGLssuV1Nh3EVn7p5RzZRF721LfeR9p9dEauJ7zn2prswR1ya7aaifECnmbCTfP3Gg25yPK+pdQ6NlKUgZ2lHbDsFO1uabcHPw X-MS-Office365-Filtering-Correlation-Id: fc9d9b81-cfda-4b9f-4d79-08d5ba97d74d X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2018 19:12:44.5444 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fc9d9b81-cfda-4b9f-4d79-08d5ba97d74d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4375 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Martin ILP32 uses the same struct sigcontext as the native ABI (i.e., LP64), but a different layout for the rest of the signal frame (since siginfo_t and ucontext_t are both ABI-dependent). Since the purpose of parse_user_sigframe() is really to parse sigcontext and not the whole signal frame, the function does not need to depend on the layout of rt_sigframe -- the only purpose of the rt_sigframe pointer is for use as a base to measure the signal frame size. So, this patch renames the function to make it clear that only the sigcontext is really being parsed, and makes the sigframe base pointer generic. A macro is defined to provide a suitable duck-typed interface that can be used with both sigframe definitions. Suggested-by: Yury Norov Signed-off-by: Dave Martin Signed-off-by: Yury Norov --- arch/arm64/kernel/signal.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) -- 2.17.0 diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index f60c052e8d1c..65406218743c 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -334,17 +334,16 @@ extern int restore_sve_fpsimd_context(struct user_ctxs *user); #endif /* ! CONFIG_ARM64_SVE */ - -static int parse_user_sigframe(struct user_ctxs *user, - struct rt_sigframe __user *sf) +static int __parse_user_sigcontext(struct user_ctxs *user, + struct sigcontext __user const *sc, + void __user const *sigframe_base) { - struct sigcontext __user *const sc = &sf->uc.uc_mcontext; struct _aarch64_ctx __user *head; char __user *base = (char __user *)&sc->__reserved; size_t offset = 0; size_t limit = sizeof(sc->__reserved); bool have_extra_context = false; - char const __user *const sfp = (char const __user *)sf; + char const __user *const sfp = (char const __user *)sigframe_base; user->fpsimd = NULL; user->sve = NULL; @@ -493,6 +492,9 @@ static int parse_user_sigframe(struct user_ctxs *user, return -EINVAL; } +#define parse_user_sigcontext(user, sf) \ + __parse_user_sigcontext(user, &(sf)->uc.uc_mcontext, sf) + static int restore_sigframe(struct pt_regs *regs, struct rt_sigframe __user *sf) { @@ -518,7 +520,7 @@ static int restore_sigframe(struct pt_regs *regs, err |= !valid_user_regs(®s->user_regs, current); if (err == 0) - err = parse_user_sigframe(&user, sf); + err = parse_user_sigcontext(&user, sf); if (err == 0) { if (!user.fpsimd)