Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1085435imj; Thu, 14 Feb 2019 00:43:05 -0800 (PST) X-Google-Smtp-Source: AHgI3IaYAT9ZtHDbkHCN3z5uyUXPayXEhdQWk9aDQSw/Kg6amx9BI63WhfDYyO/t0O5PJBtqa6Qk X-Received: by 2002:a17:902:2c83:: with SMTP id n3mr3002625plb.104.1550133785054; Thu, 14 Feb 2019 00:43:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550133785; cv=none; d=google.com; s=arc-20160816; b=UNaWbii4GGNH5mlGYvP2xeWtr/j+Vox8qenQm9d6mDvYubwMBKTgvjxNY0HRkrGpPh V3Se6hE9e/LYJikCY8O7JrtIc4ZYDB7XHDPRz92M4VkHo3MY8RayjX2lAeWpC5XvrYwW b3KGkUP8HrKxVK4X23EoMqpqRmS4A2u4QGJB0qn9oAKjBugTqEZjDhlD3S/FTlZj8COj ylu8nbTGezbXYtAxxf51OFWkzsVhRWdQ+Nb3GVtbF1VVShv2F2QAXxB79H9cnu/CLpQH PkOhGgReek6zbr/s10XqzxbAs6M43XEhpvcPAxy2PQU/5IbjWlUQRPiFC+zCB8vl1kXA EHWA== 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=5XtoX2htZ0Jn0tkRDWU+S8lIEuB+MnkGDKzlpE3hBEI=; b=BH3J6i4Ywa643cIuvlmmaS/ZTiZyECPL91SJwKD/RpMZZWgjpeRRpKrc7VjBiqj2ug 1ie+g0bvVcyJNyTpmROP8r4KcCZcTCCCxQH7fZ9MKRs0ZzFkRGZWMdrqa/GQUgz/Oqhq F4hNKcfAd5fdSBTm7Zmo0gZeXWJ8qRUWmJB0zd/CtbpjTQ/M5IEwRWhFp1R3JLlqawXo SShILiwfVCURWNE8/R4pyLD1CYVyfmYFzECv6Nvu7JcQqTmHFGw+RgvaP1i4yfRv1Kai O3qAUiq+N2mjnfVXnVKrvQABUrj8ugJsFdIn2oDD2V76PMqyIe3ncNqKdvzm3kiAZdiT 3jMA== 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: 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 f14si2312366pln.221.2019.02.14.00.42.48; Thu, 14 Feb 2019 00:43:05 -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="INlw/sfd"; 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 S2436723AbfBMVce (ORCPT + 99 others); Wed, 13 Feb 2019 16:32:34 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:40472 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394804AbfBMVc3 (ORCPT ); Wed, 13 Feb 2019 16:32:29 -0500 Received: by mail-qt1-f194.google.com with SMTP id j36so4455401qta.7 for ; Wed, 13 Feb 2019 13:32:29 -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=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=cFc93khfu/V6WGh9ZoFKIHfNWvrRYTiSSPc4U70rhoWnZ60idydf34GxZu5ihrECwn F2xChv3ANn53bZNiQ9unB3qRMovvr/6NXxPnZl8Waxvylp1Mq+HxW6q3tUS86yiQT5z2 XWhEfr4usSl7Fs5HOK1xUDPGz6RuduT27t+wBxpKArI77yaEBnabIbe/FL8DodcDHOzP B4uFRh3EEsnvqFJlwer0ONLLUtGLPWmG3TYXoRJFMnIX60TXtN8vcdyWN1SC+uFw4q/M cukFpOJwhxO2q9x4WTEfsurMMInYVxviTtsVixuKdv2fxOgkMPR0t1SZJEbE070V4tro vlAA== X-Gm-Message-State: AHQUAubI4Dq8nMd4L5tG6IAI5LE3JKQtlMYjNkGkRclpfh98sJKR+ik9 I1JMY8ooNVHKEYUVOekKgTi/fg== X-Received: by 2002:ac8:17e7:: with SMTP id r36mr249071qtk.104.1550093548757; Wed, 13 Feb 2019 13:32:28 -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 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> 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 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; } -- 2.17.1