From patchwork Thu Jan 10 17:51:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Long X-Patchwork-Id: 155246 Delivered-To: patches@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2176001jaa; Thu, 10 Jan 2019 09:51:55 -0800 (PST) X-Received: by 2002:ae9:d8c2:: with SMTP id u185mr9720058qkf.107.1547142715662; Thu, 10 Jan 2019 09:51:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547142715; cv=none; d=google.com; s=arc-20160816; b=yBbIf1JY2JaZcx29o9A6DpHkTDKgbt+wb27QzwUEh8zbKCKGBQSv3ed5ySfWAFy1hA VdUMrYks3q3WqzR8RleRzkhOZXqw1+77o4HBYu7o2dPfsRL0jMftC3jU7O7j1N6KyeNl sRsXzz2ONdjsIgTS3PCIcS2RKJSY6GbUUXAT1HobX1IyPVyfspuIs9VcfE0XwYzjmLWp pQRiyoX+I7yDdH/Ue+9fUJHK+F6JRSSfWb4CaxyhxrsMqF4Ap7IkMAsLAdRv/rdtOVCR J0fL2lly/uEH2BWidqN/zK4O3ntXfbawg/BPfQlxJaAMgCOLEQzH65YCZg4g7e2hbpA6 SRGw== 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=k2kpogJm+kzsaurb36SPfNWnAFajsG4dEo5FMhFBPl70MQIikSgX5YCx+4rqzfjHAM xzCEgyRjt6L24PjM7XAgq3KRsFIijuGoi8s2TwwJYG38duWARUXlkDNsSqGWtE5zFRv1 JFld08julluYZ1CIM+wrdOqkHJG0/Jt0v16X5g7Jupse8rAuCjiDkUbZPI/nGwWgO0oK zVWHtGpuPVbalrPNbrQf0f026Z+gfSB/v6ErNkSCa8ErwcBSxeFUQnJdQ5ZqEYlqsQmE nV9Koss64H/kYotWZJX/otDRUwY3ETRQnEFIo23pk73G1qkxUBtYo4RR1UZwDPtlVbB/ bHIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XoxxG6nI; 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 d10sor67387488qvn.64.2019.01.10.09.51.55 for (Google Transport Security); Thu, 10 Jan 2019 09:51:55 -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=XoxxG6nI; 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=XoxxG6nIkXzy5QuWXVubom4W8yRZ7hlnyFU2dEJ92pcz6crO26BV8Qil9G6EPL9U4e 7Y/ZCCM8TaGb+Y3TtIL6+IyVcm2asy6mn/NuerX3p51yj9nq9ZDYDe5/5C394iRuUTsp 7yj6AaX96rcawCb3VL17v340YPLTVWRWLfocY= 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=b2hkdh74AjjSnnN5e71770nJwr3sF+mE7sIvh7GO33DoyhAvChOXYwkWNK3tBmXDj5 gTBLxZ8RydnC8fNQlYLjfsVUPpNH+eIjVF4VRAhSrBOFt3K7DyyzabrFY8MDL5x3OETh YoGrle7n70+hNYY+xkZGtFCHNPN/m0rmXh09X2Tj684RsXuGxOhSF6TNlgSuVMHY0LCf n+KWIYr8JU8EMM/+ClUX/Y49B6LQ9d4nTNyQNbkFZFtaLqrCC7L+v3pwJHlsiHlQ4vUg AKieZtlhXThshKN0Ti+g167Zh1hZzEZCGOW/eaPjWCaxTaaoQHvCK8hfrp546BjGmLCW Nw0g== X-Gm-Message-State: AJcUukdfOsKdSAnGQxlTfN8qD5u697X+iWieB59qKAswYzH3SkYpWDRD xlURiCu47l2npca+hRcVjv/K8K6l X-Google-Smtp-Source: ALg8bN5fm7v1MtKixcl+8vLZVkwxRNJ2XAMHpZiZzP9iGYAS9AYiBk3+DprARd+bOFR8AllabA0Yvg== X-Received: by 2002:a0c:bb82:: with SMTP id i2mr10600208qvg.159.1547142715346; Thu, 10 Jan 2019 09:51:55 -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 b8sm41815904qka.79.2019.01.10.09.51.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jan 2019 09:51:54 -0800 (PST) From: David Long To: stable@vger.kernel.org, Russell King - ARM Linux , Florian Fainelli , Julien Thierry , Tony Lindgren , Marc Zyngier , Mark Rutland Cc: Greg KH , Mark Brown Subject: [PATCH 4.14 02/17] ARM: 8790/1: signal: always use __copy_to_user to save iwmmxt context Date: Thu, 10 Jan 2019 12:51:35 -0500 Message-Id: <20190110175150.5239-3-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190110175150.5239-1-dave.long@linaro.org> References: <20190110175150.5239-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; }