Received: by 10.213.65.68 with SMTP id h4csp710938imn; Fri, 6 Apr 2018 07:40:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx48UZpnbVZylgp/1iaWad0ljLUlMgVFpb+WQbQcHaTp3wWgzvIa/KHP7rgFumYe+egUfTpfV X-Received: by 10.98.163.68 with SMTP id s65mr20754099pfe.13.1523025600473; Fri, 06 Apr 2018 07:40:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523025600; cv=none; d=google.com; s=arc-20160816; b=yRyjl694JzCOYmiFvE1kLJCYuRab8DSYsj9n8BqI9vhLjzxbSV2/dWMwjQ40f9gEZN VzevWuEDxWQ4JDBYMR/j8Jc/4O2/WdR+Mqh6qUn8C7lFbSFVhui5E9qyUadsOH5/3MsN HQnsAhgldgV9JaHJpyOLVlEs3nvlphH+TvfMSmn7ZNeTZHkDsad96s8/GrsTB38vhsqn maH91TQIxTj4JbXFdRz5yFnSt/ch+nCoqv4XwQGMW1gU5Y0u/Bd1SX1/UbKTO3Muo5Tm VeE8HkB5Z1lWRCknmyrES3dIfzSYDXjSgsQdBtWz28rkWspRzj6BnGSOzZy+XsjdkCXD Z8Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=j87reN/DDdwrUMLNSJqL/TMSwRsPa5woUJ1KVf9YRNI=; b=07YTEmIYJvtQE3NfaRJJoMRQtzYlcQrvP8Psep+DiLgtjA5nci+XI44sCtaf3knTuB 51KTpJIFD99SEP6553UVKJlxSee7a/JHtzko5bDswK5HDG12YPDzxADSZtZ0LaG2uK7K 9O3ZxS66wIktrK5TG9lIY7v5eXMrZRLGC7+fIb5vaFI4Y2dNk1Ip49Vbe8l/WwwAW1HI j5tWTkVCnFw93fl+NKQ0z5ExiBRAH+EOAfjnlHuxsecTLbQGYq/a6id+riJ8cfjyfi7m KpGK50ZZOYuFERYR1dgR4TeZhqvFcBrIrG7fXWqtLpILiMXwIwipgtTGy4D/wuuXJQ97 aryA== ARC-Authentication-Results: i=1; mx.google.com; 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 v6si7137198pgs.140.2018.04.06.07.39.46; Fri, 06 Apr 2018 07:40:00 -0700 (PDT) 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; 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 S1756007AbeDFNfN (ORCPT + 99 others); Fri, 6 Apr 2018 09:35:13 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58652 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755987AbeDFNfK (ORCPT ); Fri, 6 Apr 2018 09:35:10 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7057ED85; Fri, 6 Apr 2018 13:35:09 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Mark Rutland , Laura Abbott , Shanker Donthineni , Will Deacon , Greg Hackmann , Alex Shi Subject: [PATCH 4.9 061/102] arm64: tls: Avoid unconditional zeroing of tpidrro_el0 for native tasks Date: Fri, 6 Apr 2018 15:23:42 +0200 Message-Id: <20180406084340.132540841@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180406084331.507038179@linuxfoundation.org> References: <20180406084331.507038179@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Will Deacon commit 18011eac28c7 upstream. When unmapping the kernel at EL0, we use tpidrro_el0 as a scratch register during exception entry from native tasks and subsequently zero it in the kernel_ventry macro. We can therefore avoid zeroing tpidrro_el0 in the context-switch path for native tasks using the entry trampoline. Reviewed-by: Mark Rutland Tested-by: Laura Abbott Tested-by: Shanker Donthineni Signed-off-by: Will Deacon Signed-off-by: Alex Shi [v4.9 backport] Signed-off-by: Mark Rutland [v4.9 backport] Tested-by: Will Deacon Tested-by: Greg Hackmann Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/process.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -306,17 +306,17 @@ int copy_thread(unsigned long clone_flag static void tls_thread_switch(struct task_struct *next) { - unsigned long tpidr, tpidrro; + unsigned long tpidr; tpidr = read_sysreg(tpidr_el0); *task_user_tls(current) = tpidr; - tpidr = *task_user_tls(next); - tpidrro = is_compat_thread(task_thread_info(next)) ? - next->thread.tp_value : 0; + if (is_compat_thread(task_thread_info(next))) + write_sysreg(next->thread.tp_value, tpidrro_el0); + else if (!arm64_kernel_unmapped_at_el0()) + write_sysreg(0, tpidrro_el0); - write_sysreg(tpidr, tpidr_el0); - write_sysreg(tpidrro, tpidrro_el0); + write_sysreg(*task_user_tls(next), tpidr_el0); } /* Restore the UAO state depending on next's addr_limit */