Received: by 10.223.185.116 with SMTP id b49csp66613wrg; Thu, 15 Feb 2018 16:42:07 -0800 (PST) X-Google-Smtp-Source: AH8x226No/j4Xd8Y+kPPgTGz1I5HhH9LvdTg2Hz+YuBWqqSf02mepf6WIx2VtBPvqbTX2u0ooHTs X-Received: by 2002:a17:902:61:: with SMTP id 88-v6mr4254565pla.428.1518741727145; Thu, 15 Feb 2018 16:42:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518741727; cv=none; d=google.com; s=arc-20160816; b=rE4NHeDkkTgNiVlhwDWh9IAbpCvb6Hu7zs/CKfjp+XWgNUO/MukLCTf0ejllnIXKpZ 3rNIaKXjb9dE3SSAS6lDnBUsrq6jlsNDDm5+F4ntMZ8WJ72GUyLLQ0kKBPs80UhfYY6u tsjtFgs9Dv7Osu+IqiveILGifL8bqA5Mw6j7yHV+2ylxVnVmaxqn3P/Ak2UeAtI67sYZ wXTNUc3CfOknXonkry5geaRl34wgobhCKfIAUeRcDprWhjfkZ/GcRUuckDRDJgBqdfXq 6IaWQKfNB2oEqUN7sW/VQmPx5cn/xvf/NbDZbUeilNIJMwwrV0pe59I4fTfSVGtvDJFC P6Tw== 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=vBdJpuPR/PuBTrPBmCProtQdpKyCxAXO9bfyMp0SMEI=; b=cecZcJlA8qngZpnW3iVFNG24dQa9gl1XAY1JtIJdFzm5dNx0ZlGikrhpzsOYWBJwvo Zrrx52ru09IxndxigP82HVOIQ7Af4BSCO+iAZAlBrkW15TOZTBYGh44JxTTZnnuZ5OLV EVKcIhzG3jBXjBvN/YBnhAYqL2eXW3+hFroPVvTPcOvop6dBZC9KR1GlyPDxuXpAaqHT AeBcDfgTzD+lvztN2PCBkCp4RIbzNnyI4kELQ9EQxy3Rie9MeQo/lgC6IHAwMnGN6rcs trBGBpFEydqSMW0/pa3g9x4JIgzz9B6XEKlZ2kKcJp8LfQ9++Cdta/E3oQEu5BYC+CU2 ezfg== 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 s16-v6si2322213plr.109.2018.02.15.16.41.20; Thu, 15 Feb 2018 16:42:07 -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 S1423553AbeBOPjg (ORCPT + 99 others); Thu, 15 Feb 2018 10:39:36 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:59778 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423502AbeBOPjb (ORCPT ); Thu, 15 Feb 2018 10:39:31 -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 E52E610F0; Thu, 15 Feb 2018 15:39:30 +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 023/202] [Variant 3/Meltdown] arm64: mm: Invalidate both kernel and user ASIDs when performing TLBI Date: Thu, 15 Feb 2018 16:15:23 +0100 Message-Id: <20180215151714.135182487@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 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: 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); }