Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp95694imj; Thu, 14 Feb 2019 16:07:26 -0800 (PST) X-Google-Smtp-Source: AHgI3IZPM1ZeZFcNJt65fkmKX2hcGwR1iXHD5l42SGxaym/PGBvU3AaSOXZfFdFZIKI7+UrGAuR0 X-Received: by 2002:a17:902:f20a:: with SMTP id gn10mr7031366plb.105.1550189246657; Thu, 14 Feb 2019 16:07:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550189246; cv=none; d=google.com; s=arc-20160816; b=cY1Q3It3avuw1ur52OhFouyUbpfiR5cIEzRwXbEhkXSLJVQuaSpIXrxnKbVEeEeOLl V/pfOV1zbODGe6dkOoun90AKgrNbXxuN1m07yCQuct07th4UtwXRWLNaX4Cl6Qnv5PpU fIrn1TPiQi/1T5ZIrP63C7MjnQ1qgM61ar5N0hvGFpe3vHn0Z3qKp0b/VdSEJcrwmLeN h47VvAhHYY5T7bz+2UVxfHwqYVzxCFSLNKrCCZ4AZnswIE2jt1I9vooiGlst0AnQLv4L oy3w1eP3Jbtq1jGKsTxu/+DqlPJPRrmw28JR1b6o0ufpRjqoPwC05p+8fbfkqmOSoEDk QCdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=4WIiFnR286YtXg1/WuUdSZbEmbvXJmwAS0RFyIqCoow=; b=ybqO4gSHZ+WJz4TkTiTHCfXjMGU1jCD2/LTOT3pPdVjmV9iflKxWie6h6QkX+8N8lA upgevbAqxCAEqsuI4oH+/GgFozie7t5pWCg1vs929OtAXFgq7kJzKJXdO7ctwC4tncBq mZ76Pgo8Jbl6OLBr/qcLdJJOH9c5zPt12ZFYMdlF5u7hmWSd4zm08bI8dXHq/Po9k2rG B2lRjIPxsXjEdJ0XaFI8jLjn+1AaMOs3aZiM7XE23khUyngAxCFA6tcW64g+cz8TdxAB fspkeZb7Zxu3lBJ8mZgz+NLGFVf1WkGNC/DtZlUJ3Grsh6l0Ry4Jh+8LIwciOrfuMpiO uxuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vjS+347F; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r59si4075006plb.247.2019.02.14.16.07.11; Thu, 14 Feb 2019 16:07:26 -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=@linaro.org header.s=google header.b=vjS+347F; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407277AbfBNOth (ORCPT + 99 others); Thu, 14 Feb 2019 09:49:37 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:45365 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407261AbfBNOtf (ORCPT ); Thu, 14 Feb 2019 09:49:35 -0500 Received: by mail-qt1-f194.google.com with SMTP id e5so7051947qtr.12 for ; Thu, 14 Feb 2019 06:49:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4WIiFnR286YtXg1/WuUdSZbEmbvXJmwAS0RFyIqCoow=; b=vjS+347FIqlPezMcSF9P1GiEymL0yVmYKwHcKvIn5Zh1j81NA3K8pt355ZvyM3oFEL o+nBQ1EPz/TvytR6mW8IYuHkylt/2oRDy+Al43fFGBrwOZX8yu4KxL/mWYurEImpc2v3 v1/BD0g1jWrB8FFfItN8RE8aF+3X4P4NViFcEr3XKU6mRUD/PHBBIQ/7GaX+GOjAplgS CNVm/Ka7UAUzVcOHtxp8AVZIgp3NLQQZIg+kQydJ0zQcIUNukx+fEwpNp9y1ttEQesZq 4JQaC6JzwE0F8sU8emfthgJdIuYB4l+RSYOnSlN3YSJCCIovkUmRIQ3o5LCSGCxfu6Tj YpVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4WIiFnR286YtXg1/WuUdSZbEmbvXJmwAS0RFyIqCoow=; b=IKXjuF+s6LP5TMJBJeTodhrFauRsyAk1nrljQhNaZoJKTiEEKYD4x/1ufoguSwIl3S IPqe7uNWN97pMEGxh/QyY+HemvYB0ogP/Jc9PlFDEXTpPRJ1zl83sY0XL/jaIhZsgRib Eb3yAhyh73O64uNFlpHec8uF721gyHmdB9aAXD7swRZgc4bKu93FnvKL+ERXclls8Nu7 FtZV6LHwfpFbFeLaGEjoJWzE3wxmfnGZdFQcwTXteRiHwWK6bDjne+oQ0N3yIU/qHAWe KBMg3uKMO6MZxgozuLMCaV9WElhg9N3K9iUF8TDWw7SgICzfPycuL24hAomiUN5oK/BU xPhQ== X-Gm-Message-State: AHQUAuayFXZl6BsNBHTil2E6wjRr1ppnpQHdp72n1Dtd6sndkTQ6AfL5 0ADrBkBNUnJTp8zQun2lsLdbNQ== X-Received: by 2002:a0c:d2a5:: with SMTP id q34mr3277880qvh.102.1550155774386; Thu, 14 Feb 2019 06:49:34 -0800 (PST) Received: from localhost.localdomain (pool-72-71-243-63.cncdnh.fast00.myfairpoint.net. [72.71.243.63]) by smtp.googlemail.com with ESMTPSA id k66sm1498919qkc.25.2019.02.14.06.49.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 06:49:33 -0800 (PST) From: David Long To: stable@vger.kernel.org, Russell King - ARM Linux , Florian Fainelli , Julien Thierry , Tony Lindgren , Marc Zyngier , Greg KH , Mark Rutland Cc: Will Deacon , Mark Brown , linux-kernel@vger.kernel.org Subject: [PATCH 4.9 01/16] ARM: 8789/1: signal: copy registers using __copy_to_user() Date: Thu, 14 Feb 2019 09:49:15 -0500 Message-Id: <20190214144930.27539-2-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190214144930.27539-1-dave.long@linaro.org> References: <20190214144930.27539-1-dave.long@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Julien Thierry 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 --- 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 6bee5c9b1133..fbb325ff8acc 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c @@ -256,30 +256,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.17.1