Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1180349imj; Thu, 14 Feb 2019 02:31:49 -0800 (PST) X-Google-Smtp-Source: AHgI3IYpT85KQLNDlmMb4noTzjhYlco9zGiet12kOSzB2gpBJIor7PS3igROqvauTrPbiUX0JXCG X-Received: by 2002:a62:be0c:: with SMTP id l12mr3187333pff.51.1550140309200; Thu, 14 Feb 2019 02:31:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550140309; cv=none; d=google.com; s=arc-20160816; b=RvdzdpgqXb32s+LQUBuxc6xfAwUyHRKQnQjVocpFtYPli/PRu6nRkwnh+ylBvg6xnZ v9bTOjhC/Ulk7rW6orb4WLqyZa0RdakIAU4qaB8X2t7uDzVqm1sdoEBxeoL3fXdFpxnh acYWXWqwN1gC0m8T02pT3tZCve/3RDHw0aFcF3tN5FFyAdwimJwDM5gB7PYKQRcm5It7 MC0MWteyzIRjswkSxZqpYv9buc3te+xo6D8hZhV4y7ioSaOZjW9pFRR40nxZrf9jBJ6i KPftPBwdk/5pv0wwH2d8BDecvnYl6jPrBwqWxY5srzhZVPUQdT6O+kmoTsIVBxhzxQ2I orfg== 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=AZaysvDZX4O/Bu8vrQvGUNcMZ0ecXD4hClmIQ5jet3M=; b=inH8es7CqO/+rzp2IyNktlKZ1yIAUtw36Vi9ar3jzpG+HdDFqpPyvBWzbknPRMY7SA mX6dGzXoXxfUdYYHfLhtzz2ZQRdeA1jfaZ4kS3sKaTej8gPzmbudR6oPHe+04ORxAIBq vEjyGxfozL18ghVZL4hJTn6Q8g+rCsnOwk8qtcvRabbruFLqJ5fN38IiDsWyVyAMhX3K /IES3Y4dlqEfBayHH+HzjXGB6V54cMRtB4p1NvBvWjd4B/9iRp6mmbpl029pCspbIyd1 xkL6jvqjqgyEJwt9ZEn85KFEbuLVJHvjJwklS6kLXxSzgLIeowvlG5jVwA/0+OPmAwHm 6Org== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zqofi2n+; 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 d15si1895867pgv.583.2019.02.14.02.31.32; Thu, 14 Feb 2019 02:31:49 -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=Zqofi2n+; 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 S2393912AbfBNCKd (ORCPT + 99 others); Wed, 13 Feb 2019 21:10:33 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:41697 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393875AbfBNCK2 (ORCPT ); Wed, 13 Feb 2019 21:10:28 -0500 Received: by mail-qt1-f195.google.com with SMTP id v10so5173925qtp.8 for ; Wed, 13 Feb 2019 18:10:27 -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=AZaysvDZX4O/Bu8vrQvGUNcMZ0ecXD4hClmIQ5jet3M=; b=Zqofi2n+I6J25lcFxoU+utTxRN1+3tt6/q5AcD0yTqerFBelxOHNXClBDeDPFWesXN z1ejzTUM6KvhBdEgQBM/Y3HXY1BUgvNsqVlKmBYZaOS1N+ZbgNRFMatZ0Ah3lbQsQOul Mjo3+wBFgSwGNAzieoKIBXFrTDhNLwQ8Qd0v5L5mWi8mciy4JSUx1i0QDn5FGnJCc2nk vNv4Rr6Wf2InTUsczrWWDYcsBGTfyv2ZqxNm17xA4oJkeDx+8MQI4fkDafmDpQFCJU36 acaaGvZWly6x4cTB+4+Ro7DusNFpyg1CTEU/MIfvOUcLlMEoUOM3QXn5GCTlQlGfvQkb egVQ== 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=AZaysvDZX4O/Bu8vrQvGUNcMZ0ecXD4hClmIQ5jet3M=; b=p7Dzl0Uj1txwNDW6V3yWd21YsfihzY7TJXNwgQWM2rFUOx7Ee5gn1+YE9PmuTn8qq4 ULAZd1KBrwm3DnEbdj8UTk9TkbFmZwszSzH2sOiryCT1DFlGmZ/mr+7RY7LTU6frEGnb bAgKjndKg4T8bxbWzCUzy9hwqZlp0PXd2d3/Tcnrvabdn1kVBIkiz5dRw9u0uSxk9JOY rfHU8nVmSNkdh6U9NW2LcsCbNhtNChS8E4slttE9TGaFKDIRzNAMlGKqcvbDUjrEklCe hEczuTPO8AmP6GlEB1jKCP8yTd8UEclF6L51hws+kUffkVHC//0V2J9wBgK/aFd3Gd+T qgAA== X-Gm-Message-State: AHQUAuYZjv/mCjoigqCr5XKwUYfYJPxLFW2h8Tu9PMI9JH1Jp5pGgsqH SrSqVtfOzum7m5HsGuUiyaQirw== X-Received: by 2002:aed:3ef7:: with SMTP id o52mr1079347qtf.276.1550110227507; Wed, 13 Feb 2019 18:10:27 -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 d63sm1091575qka.22.2019.02.13.18.10.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 18:10:26 -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.14 V2 02/17] ARM: 8790/1: signal: always use __copy_to_user to save iwmmxt context Date: Wed, 13 Feb 2019 21:10:07 -0500 Message-Id: <20190214021022.5313-3-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190214021022.5313-1-dave.long@linaro.org> References: <20190214021022.5313-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 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(-) diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 1dc1f39825b6..b12499cc3582 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c @@ -76,8 +76,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 @@ -85,10 +83,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; } -- 2.17.1