From patchwork Wed Feb 13 21:32:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 158254 Delivered-To: patches@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp560751jaa; Wed, 13 Feb 2019 13:32:29 -0800 (PST) X-Received: by 2002:ac8:38fc:: with SMTP id g57mr229541qtc.39.1550093548996; Wed, 13 Feb 2019 13:32:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550093548; cv=none; d=google.com; s=arc-20160816; b=pcz1K/qpBCSlvVWipNLBg3yNQAF26gXffhuQRKcF7gGLomLlX7LuCEchfGCXFbSt7B jo74/0DYWOMjdglpwWARlel6CjSdfglaosF2o9F6Eo+cis9sFCNFmRtoaEhwBCX2Hgkl CQWEuVfSAVio7H18+w1S7FZF0DFYdbXv4Op8/cDVRTd/RfiLfPjIwrMALWVhqxODZXjr 1C6kO1HPXMC6ov52EinF4valz5hWt4REULkVvaqwGGkhgQIREoD9VGLCVh1djO2T7nPT 2re6Q9jYC5JJmrLVUC00Q5Rxt0uW4JHMoMBS8ilhvj4aquQubaFyZ7+EwgDfiT1t4MRP dFyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5XtoX2htZ0Jn0tkRDWU+S8lIEuB+MnkGDKzlpE3hBEI=; b=sGttiStFd/14Fgoxes0wjkpgB9CyJYXQqVrIjN/Fc6NPICUMTMu9Ss+Yq1rDr+AeCt ZYCS0nnuzZqJuXT0MRC5R+26IgLAP8YMGo19QspkT46O/Fpd0daAApr9HL+4YE8A8qLI DMn5K4/RhiOzaqbhg9/2IMZLINB2ICq2tXmLUWnGzmik6/qBS9hWNs2Zgt+otV8laVzn uIaciLaJj+Wm2I/lf+z5qNaBSCIeLLUGRMLiLWPHB+0tESNLhNNDBY34S1xAKwQtglkl ySLCglKRsiBHOpt2KmFSaoYKvk2YBZO2DI9GcN9wTW02E06deTzPHpvbwpToyjKGRn1Y QJHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="INlw/sfd"; spf=pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=dave.long@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id l17sor582114qtj.21.2019.02.13.13.32.28 for (Google Transport Security); Wed, 13 Feb 2019 13:32:28 -0800 (PST) Received-SPF: pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="INlw/sfd"; spf=pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=dave.long@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=5XtoX2htZ0Jn0tkRDWU+S8lIEuB+MnkGDKzlpE3hBEI=; b=INlw/sfdBet8zDSCENoUwjfxegtQlubL9UmVGQ07agMByfU1HAD3H6h9a1h2loynnp zBn7NmrS7lFmiBMIz9STmkRLR4t0EGPGbcfCvbTVmPSrCy2PkE7Z0HkU7OwuAuiOjR3M TKMa7VyyFbih1CnDzcjCy6tjIIoJ0owEjYB5s10dv8Di/0rRLxE3y6e9eDMS55JtKNmH yub/0NtCqNx75NQSD4oRmEx8hWU7+SaDO+e5P9hWDV4q76VDLGbxTISVejAenTSkwwYl t5Z8E35rqVaX7ETno347GhxF/MP/k3KiU2j22qhp/IRz8CY7HuxQgbG1BQxSxnFE+Gng kcXA== 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=5XtoX2htZ0Jn0tkRDWU+S8lIEuB+MnkGDKzlpE3hBEI=; b=jT3FbQnoKEG6+yZ2Ssn8a+qC5Y7Q4JqCUu8BuC7N19xuYKs4PHmdmGcCDo36xoKnMf qvDPfJ30S+CVhQ41umxkpIojN1bG/FyGjY0K96DlhlNSq+roMzrlpZ/OrmTS3u12Vbv+ lkJviE/i1TDMI36iLhCEUS9JlZJ8L7HeyMT+/fYmY44Md+aOSPe82KzLE6FmRS6lIFD9 4H7PerNKDQgwpcSbgLjEeG/591bjvLQsb5+WiHq+exl1PAfx/Dk+vqHom2+iRtXthf+Q J5IGGx59c3kJglnyPPGz8RgliedWSv4wTVI1oGboaePcHEYbbzAUI9x6gBedO5s+hD75 /aow== X-Gm-Message-State: AHQUAua6M9c38rbpp4tomCsoZ42BI4PKWgBHOyu3K2lmxliEHjsDf8CZ rIqs5fB4vrXxh5WTAlwCmcaTQvqp X-Google-Smtp-Source: AHgI3IaAByStjv6V8O35bZXVYKzOSf+ybqp0f4fOFSaCjYM8AkzPrVq89diPIrhoukHRBUh3IUknVw== X-Received: by 2002:ac8:17e7:: with SMTP id r36mr249071qtk.104.1550093548757; Wed, 13 Feb 2019 13:32:28 -0800 (PST) Return-Path: Received: from localhost.localdomain (pool-72-71-243-63.cncdnh.fast00.myfairpoint.net. [72.71.243.63]) by smtp.googlemail.com with ESMTPSA id 8sm382675qtr.7.2019.02.13.13.32.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 13:32:28 -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.19 02/17] ARM: 8790/1: signal: always use __copy_to_user to save iwmmxt context Date: Wed, 13 Feb 2019 16:32:08 -0500 Message-Id: <20190213213223.916-3-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190213213223.916-1-dave.long@linaro.org> References: <20190213213223.916-1-dave.long@linaro.org> From: Julien Thierry Commit 73839798af7ebc6c8d0c9271ebbbc148700e521f upstream. When setting a dummy iwmmxt context, create a local instance and use __copy_to_user both cases whether iwmmxt is being used or not. 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 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 76fe75d36312..464393d241e1 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c @@ -77,8 +77,6 @@ static int preserve_iwmmxt_context(struct iwmmxt_sigframe __user *frame) kframe->magic = IWMMXT_MAGIC; kframe->size = IWMMXT_STORAGE_SIZE; iwmmxt_task_copy(current_thread_info(), &kframe->storage); - - err = __copy_to_user(frame, kframe, sizeof(*frame)); } else { /* * For bug-compatibility with older kernels, some space @@ -86,10 +84,14 @@ static int preserve_iwmmxt_context(struct iwmmxt_sigframe __user *frame) * Set the magic and size appropriately so that properly * written userspace can skip it reliably: */ - __put_user_error(DUMMY_MAGIC, &frame->magic, err); - __put_user_error(IWMMXT_STORAGE_SIZE, &frame->size, err); + *kframe = (struct iwmmxt_sigframe) { + .magic = DUMMY_MAGIC, + .size = IWMMXT_STORAGE_SIZE, + }; } + err = __copy_to_user(frame, kframe, sizeof(*kframe)); + return err; }