Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2474373imj; Mon, 18 Feb 2019 06:39:09 -0800 (PST) X-Google-Smtp-Source: AHgI3IYQowCSOQvdVJ8GsTCJesRDRVLLvOVP5WhlYq/6T9EuOpouMo/LeF0+/KrK2aMZohtGf0MB X-Received: by 2002:a17:902:503:: with SMTP id 3mr25876537plf.233.1550500749909; Mon, 18 Feb 2019 06:39:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550500749; cv=none; d=google.com; s=arc-20160816; b=eooKwctGdNJqDUyfoYjHa/K6KRaxy5Luiqm+XWWv0ZED4ohG2ldra9RtpUb9FgYuFQ avH/08D1DzjAZAT3+KmL2YUyo7IZO5yqx9EjMnML35l+wxHYZI8mNrNsKK7rhIkDNCEW 4ptoEdJNT6hVx4pT0ZNoN1iezXoceOt5A/5HAvrnP8LfHEqB1p7rBb4BhPuaJGBuf2J5 KpFKBNxA0BrSZ5RhSjAHyjb8jCpW9A7SXeKvotpePHmwDu9MfxbmHXNi7mFTrF1rRhwu vLb4ARVki9+zhNeAlWvqE6H95+PfWPgNGH/zdFbaYTNVaoPCIhDwLNEBb4hTxfwKjI3v /YdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G5/GiBDC/KGKLRU7S9qcHjaxBc16dzy0YgUfw0d+fTY=; b=q3DnC/dbvL7ZNAdhVYL7sH9UjdJYBeGM1wx0HvwxDR7fZty/C3hoq1gsrRnbE6fsmT FBWd1IdwTHjM2y288OcyjlCgFQnHTvBNS4z1KVwKzhTTu9104u7DG7Pdyd/debSxoB6A IO+LBWlNifGigR40IgrFKGYX5OYHRVB9THD3qTDeNSKWL98pxVWb7KybCsoTJbgRH+0m HFhpAiOSfPb99bUlK6seMkTnDdH3RL9KTzy8ff2vPay+JdwT4HMwJfCiMCLLXTOuWZ2G rHa6au9tYEh+ZnSwxd1WgTs9l8iOVl18cE3vBllNC+NQySX2sE2cAgv/e9hn0iSdGPxE hzwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bQKOfW69; 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 3si13187848pgc.365.2019.02.18.06.38.54; Mon, 18 Feb 2019 06:39:09 -0800 (PST) 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=@kernel.org header.s=default header.b=bQKOfW69; 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 S2387442AbfBRNzE (ORCPT + 99 others); Mon, 18 Feb 2019 08:55:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:35026 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387414AbfBRNzC (ORCPT ); Mon, 18 Feb 2019 08:55:02 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 52FE820842; Mon, 18 Feb 2019 13:55:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550498101; bh=IDqVaifCncmyqhpwyFP8PJZVk16qA/KdoKHF6I6F3I0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bQKOfW69pNuvio/X5QXAZZkMEsOlwuGow+V9Mp9+YGlmlj3oB6XxtJPUdFHObH1TE GIpTxhHZm/XpfQkP2jjl1mXXGzmCv0CSFgdH2IWx2KuUPhHBNY9TNSekyJFPKo0lzI cuHi6ADs2UjHyU4MXKzKBO0ZmwNfmlGXtNr2A07U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julien Thierry , Russell King , "David A. Long" , Sasha Levin Subject: [PATCH 4.14 05/62] ARM: 8789/1: signal: copy registers using __copy_to_user() Date: Mon, 18 Feb 2019 14:43:11 +0100 Message-Id: <20190218133506.231756602@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218133505.801423074@linuxfoundation.org> References: <20190218133505.801423074@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ Commit 5ca451cf6ed04443774bbb7ee45332dafa42e99f upstream. When saving the ARM integer registers, use __copy_to_user() to copy them into user signal frame, rather than __put_user_error(). This has the benefit of disabling/enabling PAN once for the whole copy intead of once per write. Signed-off-by: Julien Thierry Signed-off-by: Russell King Signed-off-by: David A. Long Reviewed-by: Julien Thierry Signed-off-by: Sasha Levin --- arch/arm/kernel/signal.c | 49 ++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index cdfe52b15a0a..1dc1f39825b6 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c @@ -296,30 +296,35 @@ static int setup_sigframe(struct sigframe __user *sf, struct pt_regs *regs, sigset_t *set) { struct aux_sigframe __user *aux; + struct sigcontext context; int err = 0; - __put_user_error(regs->ARM_r0, &sf->uc.uc_mcontext.arm_r0, err); - __put_user_error(regs->ARM_r1, &sf->uc.uc_mcontext.arm_r1, err); - __put_user_error(regs->ARM_r2, &sf->uc.uc_mcontext.arm_r2, err); - __put_user_error(regs->ARM_r3, &sf->uc.uc_mcontext.arm_r3, err); - __put_user_error(regs->ARM_r4, &sf->uc.uc_mcontext.arm_r4, err); - __put_user_error(regs->ARM_r5, &sf->uc.uc_mcontext.arm_r5, err); - __put_user_error(regs->ARM_r6, &sf->uc.uc_mcontext.arm_r6, err); - __put_user_error(regs->ARM_r7, &sf->uc.uc_mcontext.arm_r7, err); - __put_user_error(regs->ARM_r8, &sf->uc.uc_mcontext.arm_r8, err); - __put_user_error(regs->ARM_r9, &sf->uc.uc_mcontext.arm_r9, err); - __put_user_error(regs->ARM_r10, &sf->uc.uc_mcontext.arm_r10, err); - __put_user_error(regs->ARM_fp, &sf->uc.uc_mcontext.arm_fp, err); - __put_user_error(regs->ARM_ip, &sf->uc.uc_mcontext.arm_ip, err); - __put_user_error(regs->ARM_sp, &sf->uc.uc_mcontext.arm_sp, err); - __put_user_error(regs->ARM_lr, &sf->uc.uc_mcontext.arm_lr, err); - __put_user_error(regs->ARM_pc, &sf->uc.uc_mcontext.arm_pc, err); - __put_user_error(regs->ARM_cpsr, &sf->uc.uc_mcontext.arm_cpsr, err); - - __put_user_error(current->thread.trap_no, &sf->uc.uc_mcontext.trap_no, err); - __put_user_error(current->thread.error_code, &sf->uc.uc_mcontext.error_code, err); - __put_user_error(current->thread.address, &sf->uc.uc_mcontext.fault_address, err); - __put_user_error(set->sig[0], &sf->uc.uc_mcontext.oldmask, err); + context = (struct sigcontext) { + .arm_r0 = regs->ARM_r0, + .arm_r1 = regs->ARM_r1, + .arm_r2 = regs->ARM_r2, + .arm_r3 = regs->ARM_r3, + .arm_r4 = regs->ARM_r4, + .arm_r5 = regs->ARM_r5, + .arm_r6 = regs->ARM_r6, + .arm_r7 = regs->ARM_r7, + .arm_r8 = regs->ARM_r8, + .arm_r9 = regs->ARM_r9, + .arm_r10 = regs->ARM_r10, + .arm_fp = regs->ARM_fp, + .arm_ip = regs->ARM_ip, + .arm_sp = regs->ARM_sp, + .arm_lr = regs->ARM_lr, + .arm_pc = regs->ARM_pc, + .arm_cpsr = regs->ARM_cpsr, + + .trap_no = current->thread.trap_no, + .error_code = current->thread.error_code, + .fault_address = current->thread.address, + .oldmask = set->sig[0], + }; + + err |= __copy_to_user(&sf->uc.uc_mcontext, &context, sizeof(context)); err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(*set)); -- 2.19.1