From patchwork Fri Jun 17 23:54:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 9185235 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 4BD6A601C0 for ; Sat, 18 Jun 2016 00:01:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37A2B27EE2 for ; Sat, 18 Jun 2016 00:01:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 277732835B; Sat, 18 Jun 2016 00:01:01 +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=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D7EA927EE2 for ; Sat, 18 Jun 2016 00:00:59 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1bE3fI-00066h-GI; Fri, 17 Jun 2016 23:59:08 +0000 Received: from mail-bn1bon0093.outbound.protection.outlook.com ([157.56.111.93] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bE3cM-0001pP-8b for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2016 23:56:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-caviumnetworks-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=hIH2X12BtmEe+3WYKdVXXvu6hL/Etq9POhodmouqOrs=; b=zactTzzncETkUrw2kTX++4cZp+SRSlsR326m1yUovEw5wKjxd1Ue5Bc0877vAHcXXW1jAwCZYLWgcCnupzX7VIokXeLA+F1hjMK1anoQQqt2WfIyGSGyPSkWzSkQPNcX6DF+FSOnwPMT7qWNbdySXO/xRpxJrtVwbokXpDHAIDA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (50.233.148.158) by DM3PR07MB2249.namprd07.prod.outlook.com (10.164.33.147) with Microsoft SMTP Server (TLS) id 15.1.523.12; Fri, 17 Jun 2016 23:55:43 +0000 From: Yury Norov To: , , , , , , Subject: [PATCH 15/19] arm64: signal: share lp64 signal routines to ilp32 Date: Sat, 18 Jun 2016 02:54:24 +0300 Message-ID: <1466207668-10549-16-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1466207668-10549-1-git-send-email-ynorov@caviumnetworks.com> References: <1466207668-10549-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [50.233.148.158] X-ClientProxiedBy: CY1PR04CA0040.namprd04.prod.outlook.com (10.166.187.50) To DM3PR07MB2249.namprd07.prod.outlook.com (10.164.33.147) X-MS-Office365-Filtering-Correlation-Id: 3095acfa-a9f7-4aac-1146-08d3970ae501 X-Microsoft-Exchange-Diagnostics: 1; DM3PR07MB2249; 2:FfmtQF0/zuKRPlRYKEaX8WWGqrSYykbMdqqLxGt58wi3M5JcslY+2rD7bcJf9qDgaLfZbm2zHigl5/FJMYUExjTw9aWkBEHru5BwvLC1gjYxGt4mbVgZGGiauxQFqPrW0u5gNfqfY6eZhZL8ksym65oAdv0EV+mxBmVO9J4kPRAcTtrVlwcvb/GCc0NJ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27NBDVP+r5foFEu4UY/ruRFuN3gWrn19w73tGN0Jdtvtmq0U45Fna0qjMENN7c8l0uFrGNMS4tGdsDnbqaT0whz2ac7Y/jE8hzMA34SOgkkx2FRSfi0DyzME8jA04+wYb1mCiQCL210mMo+nz+DmaKii8jl5mPFssPmqaHUx6xLowYHxdvmSJWfe/gj0Y+EHwpd0eNFTsBC+ZV9Fvn8SqV+EiEf9UI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(22074186197030); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:DM3PR07MB2249; BCL:0; PCL:0; RULEID:; SRVR:DM3PR07MB2249; X-Microsoft-Exchange-Diagnostics: 1; DM3PR07MB2249; 4:kB1KS7RPe8fkinjTEL7aAi7F6pFrRWqPbKuqjpc5nv01FGzI5zaIrhpaGYRQEzFVDgpaqKrxwV44NOxKFw/vn2A5WpNdZXr/4NeTZePnFNE52L9D9QDUiP4ott5uYcvJ8K47IfPt6LGQLoMBuozKufJHwi/NXRuYfQ9sfLuQ1CHk31IKrRJHv+wLBF0y6ZF1VplbaWvQWajKvf2MyjSs7eg4f7sUcEfJRGTM94a+jp0wXhEYSBNapqh5th6aAeA36Ju6UGC7Ardu4iSjKa16ODCRBqYLlyZ+n2rdvv/+2NsRSJRdhqCVi7PycjzX6RnR4cUeePZVX5VTZy3eFy6tWpuTcqDAQ1t/GTkjO426MRBHm8+jbNsuvz4E2/ul69FEKfwmCS7OLILveR1+/FPR5oCWjefZFGjy3idyqQEfTkDSP2pkXgeb9AcLLVp+/oiQ X-Forefront-PRVS: 09760A0505 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(189002)(199003)(76176999)(50986999)(3846002)(6116002)(66066001)(586003)(47776003)(97736004)(105586002)(5001770100001)(50226002)(189998001)(2201001)(2950100001)(229853001)(81166006)(77096005)(81156014)(15975445007)(8676002)(106356001)(68736007)(42186005)(36756003)(2906002)(76506005)(19580395003)(4326007)(19580405001)(101416001)(50466002)(48376002)(7846002)(92566002)(5004730100002)(5003940100001)(33646002)(2004002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM3PR07MB2249; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM3PR07MB2249; 23:fWnn2gkGxNse2W0rWgj6Cnu+vMGQUC4GIGEsgxyld?= =?us-ascii?Q?2KMAv4ApJ7s4LfFEt/uzmRMr/eqD9mTqeo681AxhljJx4Enel9oCuxoIaLBZ?= =?us-ascii?Q?RcN6sAY0K44BOYDIsQZ4JPrQkeaTONaDS0vcPi4QqcfcRVH0igTo3FX+eGpU?= =?us-ascii?Q?4TWOzVtfNF63+o3Y30MHKTxJ4h9wtard+6SgLmdt9lPM45VFMD1WWOunhXO4?= =?us-ascii?Q?RTKBNoLNP/bR9wpGXgs6DMDXSX1HcV4eY6PCTWv9dvagUGM20hkdDCUOZnRx?= =?us-ascii?Q?fpW3YcNQ5ury4NT2P9tAonDwDfztnb7iCIeuoLccy5izSx5Hf3n4dQDD0Rld?= =?us-ascii?Q?csBRt9n3X9/LkCVoqxiNUWmaWP4Dtk7o3XR85I0FFJVm/84rtkvJ5fPNr5eF?= =?us-ascii?Q?rHvJDTRDCrfa+5wUCTlWEsBGorkprANpetinX9fabuizEmFzZKk6JMI5XnTk?= =?us-ascii?Q?RYpaAq8f0VbPcwsTo9903LqWWihjt2bzVZ0orxyjJTgKVHN4h081LTtkSvLi?= =?us-ascii?Q?kj8FBDfbxU9oox0bFBNjro95uuM7r1+L1NVL54Ev7VoAKdz7nZd9N84paUSz?= =?us-ascii?Q?qOSdW9QG0Dh0HpSS56tnhTd6R0KgK8kHpMwQ879Vtbjb8BhfT3wiIZL50wIJ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+yhtCtIjxRuXZxk9eW/A1oExLKgM9CGgX1JVs3ySUpA==; 24:7XbpdFmRMwwZjZbI5F6bLNxh0lcDFmVCbKoI+vSRlZTraH9CxJ7res+iJwPCcCiPzGVY7Kx/uRYN9DYbAFQ8YgmQ9CUJx7GGX5TOoHiyTL4=; 7:dWtcXe/rrnwglwL/2hXyPQIGRN3rcsMF9hF6CKrVeV2kGFLp+UqX2uhXV/ncSN/QKhTOprxxl3oZRXuVY4pJi5IELV3iUBCHD4y9zvrBsYovqWq1FarpWZEdrbxQnQjJ8RD0mKYd/l2DxRYnLY4XljPLqNy/a3aC6hrCdeuLP5UrY2IR4BqrkJ/EgDhW1RZieCnIsdbmIqe2fee1ssAsC0ZDGOIerk2hRFcx2L18tBJkpGX4ueHqsNTOStxIeugJ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2016 23:55:43.5220 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR07MB2249 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160617_165607_042474_39CEB8B7 X-CRM114-Status: GOOD ( 17.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kilobyte@angband.pl, manuel.montezelo@gmail.com, pinskia@gmail.com, szabolcs.nagy@arm.com, Nathan_Lynch@mentor.com, heiko.carstens@de.ibm.com, agraf@suse.de, geert@linux-m68k.org, Prasun.Kapoor@caviumnetworks.com, klimov.linux@gmail.com, broonie@kernel.org, ynorov@caviumnetworks.com, maxim.kuvyrkov@linaro.org, schwidefsky@de.ibm.com, bamvor.zhangjian@huawei.com, philipp.tomsich@theobroma-systems.com, linyongting@huawei.com, davem@davemloft.net, joseph@codesourcery.com, christoph.muellner@theobroma-systems.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP After that, it will be possible to reuse it in ilp32. Signed-off-by: Yury Norov --- arch/arm64/include/asm/signal_common.h | 33 ++++++++++++ arch/arm64/kernel/signal.c | 93 +++++++++++++++++++++------------- 2 files changed, 92 insertions(+), 34 deletions(-) create mode 100644 arch/arm64/include/asm/signal_common.h diff --git a/arch/arm64/include/asm/signal_common.h b/arch/arm64/include/asm/signal_common.h new file mode 100644 index 0000000..756ed2c --- /dev/null +++ b/arch/arm64/include/asm/signal_common.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 1995-2009 Russell King + * Copyright (C) 2012 ARM Ltd. + * Copyright (C) 2016 Cavium Networks. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __ASM_SIGNAL_COMMON_H +#define __ASM_SIGNAL_COMMON_H + +#include +#include +#include + +int preserve_fpsimd_context(struct fpsimd_context __user *ctx); +int restore_fpsimd_context(struct fpsimd_context __user *ctx); +int setup_sigcontext(struct sigcontext __user *uc_mcontext, struct pt_regs *regs); +int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sf); +void setup_return(struct pt_regs *regs, struct k_sigaction *ka, + void __user *frame, off_t sigframe_off, int usig); + +#endif /* __ASM_SIGNAL_COMMON_H */ diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index be02f65..5c73864 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -34,18 +34,26 @@ #include #include #include +#include + +#define RT_SIGFRAME_FP_POS (offsetof(struct rt_sigframe, sig) \ + + offsetof(struct sigframe, fp)) + +struct sigframe { + struct ucontext uc; + u64 fp; + u64 lr; +}; /* * Do a signal return; undo the signal stack. These are aligned to 128-bit. */ struct rt_sigframe { struct siginfo info; - struct ucontext uc; - u64 fp; - u64 lr; + struct sigframe sig; }; -static int preserve_fpsimd_context(struct fpsimd_context __user *ctx) +int preserve_fpsimd_context(struct fpsimd_context __user *ctx) { struct fpsimd_state *fpsimd = ¤t->thread.fpsimd_state; int err; @@ -65,7 +73,7 @@ static int preserve_fpsimd_context(struct fpsimd_context __user *ctx) return err ? -EFAULT : 0; } -static int restore_fpsimd_context(struct fpsimd_context __user *ctx) +int restore_fpsimd_context(struct fpsimd_context __user *ctx) { struct fpsimd_state fpsimd; __u32 magic, size; @@ -93,22 +101,30 @@ static int restore_fpsimd_context(struct fpsimd_context __user *ctx) } static int restore_sigframe(struct pt_regs *regs, - struct rt_sigframe __user *sf) + struct sigframe __user *sf) { sigset_t set; - int i, err; - void *aux = sf->uc.uc_mcontext.__reserved; - + int err; err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set)); if (err == 0) set_current_blocked(&set); + err |= restore_sigcontext(regs, &sf->uc.uc_mcontext); + return err; +} + + +int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *uc_mcontext) +{ + int i, err = 0; + void *aux = uc_mcontext->__reserved; + for (i = 0; i < 31; i++) - __get_user_error(regs->regs[i], &sf->uc.uc_mcontext.regs[i], + __get_user_error(regs->regs[i], &uc_mcontext->regs[i], err); - __get_user_error(regs->sp, &sf->uc.uc_mcontext.sp, err); - __get_user_error(regs->pc, &sf->uc.uc_mcontext.pc, err); - __get_user_error(regs->pstate, &sf->uc.uc_mcontext.pstate, err); + __get_user_error(regs->sp, &uc_mcontext->sp, err); + __get_user_error(regs->pc, &uc_mcontext->pc, err); + __get_user_error(regs->pstate, &uc_mcontext->pstate, err); /* * Avoid sys_rt_sigreturn() restarting. @@ -145,10 +161,10 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) if (!access_ok(VERIFY_READ, frame, sizeof (*frame))) goto badframe; - if (restore_sigframe(regs, frame)) + if (restore_sigframe(regs, &frame->sig)) goto badframe; - if (restore_altstack(&frame->uc.uc_stack)) + if (restore_altstack(&frame->sig.uc.uc_stack)) goto badframe; return regs->regs[0]; @@ -162,27 +178,36 @@ badframe: return 0; } -static int setup_sigframe(struct rt_sigframe __user *sf, +static int setup_sigframe(struct sigframe __user *sf, struct pt_regs *regs, sigset_t *set) { - int i, err = 0; - void *aux = sf->uc.uc_mcontext.__reserved; - struct _aarch64_ctx *end; + int err = 0; /* set up the stack frame for unwinding */ __put_user_error(regs->regs[29], &sf->fp, err); __put_user_error(regs->regs[30], &sf->lr, err); + err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(*set)); + err |= setup_sigcontext(&sf->uc.uc_mcontext, regs); + + return err; +} + +int setup_sigcontext(struct sigcontext __user *uc_mcontext, + struct pt_regs *regs) +{ + void *aux = uc_mcontext->__reserved; + struct _aarch64_ctx *end; + int i, err = 0; for (i = 0; i < 31; i++) - __put_user_error(regs->regs[i], &sf->uc.uc_mcontext.regs[i], + __put_user_error(regs->regs[i], &uc_mcontext->regs[i], err); - __put_user_error(regs->sp, &sf->uc.uc_mcontext.sp, err); - __put_user_error(regs->pc, &sf->uc.uc_mcontext.pc, err); - __put_user_error(regs->pstate, &sf->uc.uc_mcontext.pstate, err); - __put_user_error(current->thread.fault_address, &sf->uc.uc_mcontext.fault_address, err); + __put_user_error(regs->sp, &uc_mcontext->sp, err); + __put_user_error(regs->pc, &uc_mcontext->pc, err); + __put_user_error(regs->pstate, &uc_mcontext->pstate, err); - err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(*set)); + __put_user_error(current->thread.fault_address, &uc_mcontext->fault_address, err); if (err == 0) { struct fpsimd_context *fpsimd_ctx = @@ -229,14 +254,14 @@ static struct rt_sigframe __user *get_sigframe(struct ksignal *ksig, return frame; } -static void setup_return(struct pt_regs *regs, struct k_sigaction *ka, - void __user *frame, int usig) +void setup_return(struct pt_regs *regs, struct k_sigaction *ka, + void __user *frame, off_t fp_pos, int usig) { __sigrestore_t sigtramp; regs->regs[0] = usig; regs->sp = (unsigned long)frame; - regs->regs[29] = regs->sp + offsetof(struct rt_sigframe, fp); + regs->regs[29] = regs->sp + fp_pos; regs->pc = (unsigned long)ka->sa.sa_handler; if (ka->sa.sa_flags & SA_RESTORER) @@ -257,17 +282,17 @@ static int setup_rt_frame(int usig, struct ksignal *ksig, sigset_t *set, if (!frame) return 1; - __put_user_error(0, &frame->uc.uc_flags, err); - __put_user_error(NULL, &frame->uc.uc_link, err); + __put_user_error(0, &frame->sig.uc.uc_flags, err); + __put_user_error(NULL, &frame->sig.uc.uc_link, err); - err |= __save_altstack(&frame->uc.uc_stack, regs->sp); - err |= setup_sigframe(frame, regs, set); + err |= __save_altstack(&frame->sig.uc.uc_stack, regs->sp); + err |= setup_sigframe(&frame->sig, regs, set); if (err == 0) { - setup_return(regs, &ksig->ka, frame, usig); + setup_return(regs, &ksig->ka, frame, RT_SIGFRAME_FP_POS, usig); if (ksig->ka.sa.sa_flags & SA_SIGINFO) { err |= copy_siginfo_to_user(&frame->info, &ksig->info); regs->regs[1] = (unsigned long)&frame->info; - regs->regs[2] = (unsigned long)&frame->uc; + regs->regs[2] = (unsigned long)&frame->sig.uc; } }