Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2427953imj; Mon, 18 Feb 2019 05:56:44 -0800 (PST) X-Google-Smtp-Source: AHgI3IaeRBofpu3QnwrSbxFCOzA75ygz4ziPDrt3LKJ2vi6rAtsEmEWjvJ9vjajiP1DFI7ogAXo4 X-Received: by 2002:a63:6c43:: with SMTP id h64mr18131680pgc.22.1550498204847; Mon, 18 Feb 2019 05:56:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550498204; cv=none; d=google.com; s=arc-20160816; b=D/zz+a4W6KJ/L1AVAhIzjr+NQbervdwJYNy5VUu/89RYacYOP7TtVLoMUn33Gj9X6s ZsJTlNOCwDXqTZde+vGTeyceeQNoE9LwHzpdWrjB006nh0pyMvgDdFuKEAcTbSU8TMP4 vJ0dg0DJU76pRrlvU8TSg4R4Oa1d7FYYMZnJKjhd5j9JYB1EZy+wz3TxlzNqd7BMNb3t ogEx2xRSAOC1oHQtYePJj8Tvk3EeYnMeXlvbQ5WfmnvJQM8oxlka6TFheFd0NoW0gd7/ TK0XjelP9vHZTpl0gaokTSfehL9fXNBAOWmTh7rP9b2toVgb/7sf8oJVmUQn7RDkKjEV 2Oiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Esinvo48gGk+DUlIxj7B20b/k0wIyeQDL5Rsw/5t7Pw=; b=I+pYO867nhBk0uzSR/mx0tekpne7OVqaxKkTMLwHFEbPLSAYiFnvt4JiDgH3oHh66r vXBiDigWwmrsEauR84YWSHpFdz8C5s+yNec4AXtgfChKYGOHdLWBHzZ9uESV7rYhPy3D IXj3rOWdWzfo8vAnpJR9ifx8tSuiCXBRcBpONk3XVKKGTeIB9jKCGjKcAFiQOSmyL1v3 Z5hlomnvKdOJa/KoSjRdncU2I9bNUEVK0ugszIrfzxSX0KOQJvxHuaXXNtna05XL6zBQ 1G6mramxTocc8LKV8i2FMP8xHb4pz1y/S5JxWClg77k+2Zbc03J3e6fR5s6M16auZvF9 N4IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NTMcg73x; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y4si12532648pgv.520.2019.02.18.05.56.29; Mon, 18 Feb 2019 05:56:44 -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=@kernel.org header.s=default header.b=NTMcg73x; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387456AbfBRNzI (ORCPT + 99 others); Mon, 18 Feb 2019 08:55:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:35082 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387446AbfBRNzF (ORCPT ); Mon, 18 Feb 2019 08:55:05 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0C301217D9; Mon, 18 Feb 2019 13:55:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550498104; bh=Pfqgf6qkYUj6MjWIH5UWOVX1JqVa+YcUE6i14hnlE80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NTMcg73xp7sD4g9jYp1fzf4twqTaukSAY30gWpJD20CWQbFuzZlo9aAqR0CaKc6yy /rrG6qi0I4osKkQKYjs1e+MinBIhClep4QI15zQoR3IBYpXj8BkB6aAmqS7xWylFG5 ZN0OFzQ+ufJQkgXJZf4LTsGj11sOKttG40au75pw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julien Thierry , Russell King , "David A. Long" , Sasha Levin Subject: [PATCH 4.14 06/62] ARM: 8790/1: signal: always use __copy_to_user to save iwmmxt context Date: Mon, 18 Feb 2019 14:43:12 +0100 Message-Id: <20190218133506.328269515@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218133505.801423074@linuxfoundation.org> References: <20190218133505.801423074@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Reviewed-by: Julien Thierry Signed-off-by: Sasha Levin --- 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.19.1