Received: by 10.223.185.116 with SMTP id b49csp454229wrg; Fri, 16 Feb 2018 01:40:28 -0800 (PST) X-Google-Smtp-Source: AH8x226+wRKcyNC2Zb/htAGyjegr93EQKDOxkdP0492djbT/3+UawCd9TJK0os00IjTNTrhbVCPb X-Received: by 10.99.125.22 with SMTP id y22mr4225991pgc.125.1518774028151; Fri, 16 Feb 2018 01:40:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518774028; cv=none; d=google.com; s=arc-20160816; b=dxTKpdgVGT3Mz3DHnyVloBMZihx2lFe/citKKxfNJ9YHqmi75MnjB9btb+eICVNUPt xeEtLFYr5YeYOYdvcGaRCHIBTeVo31YOOSHuU5fQ7BYB2KeuwGyNnr0ZCQZjNV6HGbnX 1Kp/vV/vGCJfiIxrNj9ZsGydiGnfw2yIfu97jRm1U+R9lEdC5IU0qCcBfQ3lURNC9hng 570bexOeSqvyFQOpfFT0zvvQp/sZ+s4DosG/+JaWHtFetrOBBLESR6e8QMHZRMc7ZtXH bqXJNq7Pp681UOa1KkeYpnld/xTeuQEjbgqa5VLyBuijihonRp5OBqMsHL5Apy2ME64a G5ag== 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=h8eM+qBH6hjecTi/tMLOUAYmMJJFuMKvjKjpnRKxcIk=; b=IJ31LEdRhsvxUZ4p3rq8WuiHQZ1WiphMolm9xM3U7JA1NXN4afeV8fZKDCEzwFgiew IbfbUkBuX0gMmHQKmdGB/pBB0KARoSSGa0uF6a9x+SX0GBKKJWVgfUVjj1o9Wwto40ud +ZVP+kI1KsI4yj1ZI0DO26h5Y5k2Xr9DgSR6axIyekOR7AZqoM03nYCevhfk8xbWRF1y QvC7XhwiwxWRmnd8dXHkoP6/WzE/+apfLs3xbbAxtTrbhIcchYQb3XQtM9ImqXRY0YIp SDJKxMshM0Pq9l/XHvJrus4zBVe/6tmEh/ThNldHcDXlvHir9xbuyGYOlZiHERwqxuIi On5A== 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 w5si5143188pgs.259.2018.02.16.01.40.13; Fri, 16 Feb 2018 01:40:28 -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; 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 S1426642AbeBOQyr (ORCPT + 99 others); Thu, 15 Feb 2018 11:54:47 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:59906 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423610AbeBOPjx (ORCPT ); Thu, 15 Feb 2018 10:39:53 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id CC74910F0; Thu, 15 Feb 2018 15:39:52 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Rutland , Laura Abbott , Shanker Donthineni , Will Deacon Subject: [PATCH 4.15 030/202] [Variant 3/Meltdown] arm64: tls: Avoid unconditional zeroing of tpidrro_el0 for native tasks Date: Thu, 15 Feb 2018 16:15:30 +0100 Message-Id: <20180215151714.545675915@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 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.15-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: Greg Kroah-Hartman --- arch/arm64/kernel/process.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -370,16 +370,14 @@ void tls_preserve_current_state(void) static void tls_thread_switch(struct task_struct *next) { - unsigned long tpidr, tpidrro; - tls_preserve_current_state(); - 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 */