Received: by 10.223.185.116 with SMTP id b49csp2558002wrg; Thu, 15 Feb 2018 13:36:49 -0800 (PST) X-Google-Smtp-Source: AH8x224pTI2Nxd2J/ru193vT8cv9iZMDi+4R7wCYxlzNMLhIWFb+UbkDbI8XtpTqBVo69F/bkLlW X-Received: by 10.99.115.67 with SMTP id d3mr3348185pgn.223.1518730608991; Thu, 15 Feb 2018 13:36:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518730608; cv=none; d=google.com; s=arc-20160816; b=bW/ULk+R2NPDrCj8K/bbdDeUptl37YXNseHQ66Kx3GR3h6tkKcL8wFmYV6+gOIu9Fs X8NyRuL4ZC/5EY1E/xD9uQOlW5astKE3+EhEVeOmiLEU/BBXO5zY1ar48TMJMSfJ1V1B s2/Y3ytdDzUnrXBQwSmI/+UYersxO9pjuxXfgnrBzHHDknger/2/LNlrziXBTunxN2Y7 yVtSm86XhPCKc8TsOj55myVgp+Xkm3z2tAGiede2ADtW9US+h0MSq7GWvnQyV9gJMhWO Gv+5RWUlVNCtLfyS5mE3RjeFfx0kABz3w37Nal51g7tfgZklk2UwNiLiWk3wWCNi6VTx /uzA== 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=LNgAbbbd4rOoAwX2YvwiDaBOCxNvX2h5Ew4qS1461ec=; b=MJQRs2c/cZIuZX3B1qTuBy3uHwiqHxb+htl/sFZtdgEd5SdEGf83wmF+C50zVAt8+7 cPEBCApFaaFwu6n0UArfNnoOB2eCDTkambQiHhGkI6xNF4D/DAECNiISwYN3OK4Zag0r K3KbV8SlxApVj83h5OuYbuNxcl9DOkrkfXSx5gQdiPxq6G0ge0XkYXISt1WN9OSvbLqP M2Hh5lDMJMwoio4UcTIV6eri8wC2VgBUmWe50cO5wFwpookTzEGTE7Te30t5KoMKfkPZ 9htn0UHP+js7aI1dCNRNUMzqawiM0VClfiz33Xc4P5c8rc8Rk/UUchEkTzHzMd6eTjjk Cj6g== 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 s21si4402460pfm.325.2018.02.15.13.36.34; Thu, 15 Feb 2018 13:36:48 -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 S1164316AbeBOPa5 (ORCPT + 99 others); Thu, 15 Feb 2018 10:30:57 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:55260 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164304AbeBOPay (ORCPT ); Thu, 15 Feb 2018 10:30:54 -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 485041149; Thu, 15 Feb 2018 15:30:53 +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 , Ard Biesheuvel Subject: [PATCH 4.14 031/195] [Variant 3/Meltdown] arm64: mm: Invalidate both kernel and user ASIDs when performing TLBI Date: Thu, 15 Feb 2018 16:15:22 +0100 Message-Id: <20180215151707.308102857@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151705.738773577@linuxfoundation.org> References: <20180215151705.738773577@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Will Deacon Commit 9b0de864b5bc upstream. Since an mm has both a kernel and a user ASID, we need to ensure that broadcast TLB maintenance targets both address spaces so that things like CoW continue to work with the uaccess primitives in the kernel. Reviewed-by: Mark Rutland Tested-by: Laura Abbott Tested-by: Shanker Donthineni Signed-off-by: Will Deacon Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- arch/arm64/include/asm/tlbflush.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) --- a/arch/arm64/include/asm/tlbflush.h +++ b/arch/arm64/include/asm/tlbflush.h @@ -23,6 +23,7 @@ #include #include +#include /* * Raw TLBI operations. @@ -54,6 +55,11 @@ #define __tlbi(op, ...) __TLBI_N(op, ##__VA_ARGS__, 1, 0) +#define __tlbi_user(op, arg) do { \ + if (arm64_kernel_unmapped_at_el0()) \ + __tlbi(op, (arg) | USER_ASID_FLAG); \ +} while (0) + /* * TLB Management * ============== @@ -115,6 +121,7 @@ static inline void flush_tlb_mm(struct m dsb(ishst); __tlbi(aside1is, asid); + __tlbi_user(aside1is, asid); dsb(ish); } @@ -125,6 +132,7 @@ static inline void flush_tlb_page(struct dsb(ishst); __tlbi(vale1is, addr); + __tlbi_user(vale1is, addr); dsb(ish); } @@ -151,10 +159,13 @@ static inline void __flush_tlb_range(str dsb(ishst); for (addr = start; addr < end; addr += 1 << (PAGE_SHIFT - 12)) { - if (last_level) + if (last_level) { __tlbi(vale1is, addr); - else + __tlbi_user(vale1is, addr); + } else { __tlbi(vae1is, addr); + __tlbi_user(vae1is, addr); + } } dsb(ish); } @@ -194,6 +205,7 @@ static inline void __flush_tlb_pgtable(s unsigned long addr = uaddr >> 12 | (ASID(mm) << 48); __tlbi(vae1is, addr); + __tlbi_user(vae1is, addr); dsb(ish); }