Received: by 10.213.65.68 with SMTP id h4csp712385imn; Fri, 6 Apr 2018 07:41:32 -0700 (PDT) X-Google-Smtp-Source: AIpwx49owWq/uGkunP5AmUru21bNE49caQ8G487SJxLQkHOuaNIr4sS2z2/8B3NN+t30tVfZ7pMq X-Received: by 2002:a17:902:1681:: with SMTP id h1-v6mr19755277plh.145.1523025692749; Fri, 06 Apr 2018 07:41:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523025692; cv=none; d=google.com; s=arc-20160816; b=b+jWYnWX8dff2mlGBUN8+VUCltKtpAdzmKwzIkRrDWJzj0ZZVqpdlQmEZNZNDUVf5p YqU4kVXZ8IMkXggUWovOo1Dud/HpBC6I1PSWrpgn/GIFC69EWZSC519Yyb2S9/zMUP5h FEor2vyJRt2sWlY2YUagqVC3BMP0+h4FAfcugYxZOi9oyUwD8Xa4rmgx94aWKuE1QriO S+wD4DWTix/m7aPBbIN7IdyLXgv8W2+nQbmRdJ2Tlsk8s+iLBxSzn5uZPJRbZ37wsXMy qMhtrhDIzyE7F5KKH5CiJEvronH7+OTV7HqKgVEDrMoAl+wPzmb0jxG8osfXlBfXjB6p lidg== 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=NVtQTc1d4kyeV81pdC/lhmzrnhJjeVoe8LzNFlwWVUg=; b=oHOnPXqqtXRrLBHUpQfkknEDvrFaFRPVAUHXOKWO+iVlobT2Eb1De4SwytBVhxeg9U TaoVQiw7wf3PENbQlgnaqbt4XDzamNZP1WLc4DpEY3sVI2R3FM73tawIyuq5mw2jlsIE dZQ6WGmUVBZKwRIg2B+Yx2ML8bekATe5z8ak++NZns/jvxWdzK8+tsHz9/Nln1rmugf0 D6cM/4SnKf1zNS6ogS3FHchMSEDBh2RNgylaS57L84vItMW/d7iYSyThhtVCbBBlKSZr 676Jtn9xstmOnoZJdZwrstZsv9TCV9I5rcQ3nB3EaOOmcxFZLAyhjNpoRFX8oDcP+V+6 J3cA== 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 b13si6115359pfi.53.2018.04.06.07.41.18; Fri, 06 Apr 2018 07:41:32 -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 S1755750AbeDFOkG (ORCPT + 99 others); Fri, 6 Apr 2018 10:40:06 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58496 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755584AbeDFNer (ORCPT ); Fri, 6 Apr 2018 09:34:47 -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 0BC3ADAC; Fri, 6 Apr 2018 13:34:46 +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 054/102] arm64: mm: Invalidate both kernel and user ASIDs when performing TLBI Date: Fri, 6 Apr 2018 15:23:35 +0200 Message-Id: <20180406084339.231028588@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 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: 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/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. @@ -42,6 +43,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 * ============== @@ -103,6 +109,7 @@ static inline void flush_tlb_mm(struct m dsb(ishst); __tlbi(aside1is, asid); + __tlbi_user(aside1is, asid); dsb(ish); } @@ -113,6 +120,7 @@ static inline void flush_tlb_page(struct dsb(ishst); __tlbi(vale1is, addr); + __tlbi_user(vale1is, addr); dsb(ish); } @@ -139,10 +147,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); } @@ -182,6 +193,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); }