From patchwork Thu Feb 14 02:10:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 158275 Delivered-To: patches@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp793659jaa; Wed, 13 Feb 2019 18:10:27 -0800 (PST) X-Received: by 2002:a37:4d03:: with SMTP id a3mr946504qkb.181.1550110227759; Wed, 13 Feb 2019 18:10:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550110227; cv=none; d=google.com; s=arc-20160816; b=PZfKMBtxbSCLA+2ahEi8S/iIrIxCA03upIzSbzsThVs/m1AL6DjimJOaSHznASrx3a 2JO68O2E7AabPyWKLFXCTvS9kA2bWiFOpPT+LNot9wFU0T4bXmZ6zWfwnZcLmFYHGfob GiiSLSucybHge1OV+fhTDjX/jyyVuSxWPTa8FeMz/iW2ZhlkP9d0t8nnGenQ5pVZoaZS E8yelyWKVhHVu96p0VU8MaTRyPNQqpdtYTqnr9F1eQHbt4PfRBZyNOpU0cDcDb9MzvIY 7eE0dU5llvtjs0yKj2WxIH28+59xwEwNvIG6oNZCXGNGLvt8wPVli9yANYiKsy/FALZV oaBA== 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=AZaysvDZX4O/Bu8vrQvGUNcMZ0ecXD4hClmIQ5jet3M=; b=rj9Ki56U35vn6q366jYQSfzlnmMtjjMnEBhndSYfqqvsgXOi980C2uz0u3n6gdukrn lFiaPmF/YbjpzweFRsh6fXZwKVO3zyrASynL3y+Q+PYtRh+JK5KhUP8gcqDdZBsd/y+J c+96WyiXgWmGeCyCMUQ67xrvfZSTldUXKarq75ft1Wfi/vg4eZIHy0vIAaijA9/BIZSH 20/BMg9xGDsovn6xKwL+WrvqLRUyob7CNOQF8wqP/DmRSE5fdohtymaS/KkgQVtKwH3i /I+5AP1f1GOka6o7fmymL2lZV1euRKq5ahR/Snfkq46e8MTQeON6ApWSm5Iq9LD7ACnX nfJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zqofi2n+; 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 r35sor1269648qtr.48.2019.02.13.18.10.27 for (Google Transport Security); Wed, 13 Feb 2019 18:10:27 -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=Zqofi2n+; 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=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=LlNvsEciN4BnYUoHCGoWhdr/T39Fhf46YF7FKvtejvowKShFw4FBaecieGBWsemeSk vzN9tab/apjKraqbzda33D+hJRjOLPCd8AVv4EQxguQBma5EhscB3iZaeoaeYFIwPQ1x 66tM6rl9wan1Kb0k9WHGH3PC5GZQDDzAVBX2JaLznZQ8PcvW2VJ2gHGth9LxMyUoNVhq ajj+xVQIvrVOQaJsBSD8jVdOeq8Gcd1tyRElX4CMb5g7NYsjWXBy1O9TbK8YsoU4g+AA mgUGUHKcDTmzdqFQiFDx4VjAaRJqIzmukKyaYr3tH0wc/PAFbrQyjhj7G1FhclI1ID1w Xy5Q== X-Gm-Message-State: AHQUAuapRY6oLk42Cwhgo/9mkDpmRQKg7APkfxh4MrHxHirD9Rn/ZXyg efy2poqu43BAP20mWlVqCfyuJ6be X-Google-Smtp-Source: AHgI3IZiSsetuliD1FYf/uzQZwhkfFxbABKBD2LRuA0i/09q02mdj1Hkf3uWB6pr8CJikGqsfr6JJg== X-Received: by 2002:aed:3ef7:: with SMTP id o52mr1079347qtf.276.1550110227507; Wed, 13 Feb 2019 18:10:27 -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 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> 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 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; }