Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752740AbdHNQfk (ORCPT ); Mon, 14 Aug 2017 12:35:40 -0400 Received: from mail-io0-f182.google.com ([209.85.223.182]:35796 "EHLO mail-io0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751042AbdHNQfi (ORCPT ); Mon, 14 Aug 2017 12:35:38 -0400 Date: Mon, 14 Aug 2017 10:35:36 -0600 From: Tycho Andersen To: Mark Rutland Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel-hardening@lists.openwall.com, Marco Benatto , Juerg Haefliger , Juerg Haefliger Subject: Re: [kernel-hardening] [PATCH v5 04/10] arm64: Add __flush_tlb_one() Message-ID: <20170814163536.6njceqc3dip5lrlu@smitten> References: <20170809200755.11234-1-tycho@docker.com> <20170809200755.11234-5-tycho@docker.com> <20170812112603.GB16374@remoulade> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170812112603.GB16374@remoulade> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1808 Lines: 56 Hi Mark, On Sat, Aug 12, 2017 at 12:26:03PM +0100, Mark Rutland wrote: > On Wed, Aug 09, 2017 at 02:07:49PM -0600, Tycho Andersen wrote: > > From: Juerg Haefliger > > > > Add a hook for flushing a single TLB entry on arm64. > > > > Signed-off-by: Juerg Haefliger > > Tested-by: Tycho Andersen > > --- > > arch/arm64/include/asm/tlbflush.h | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h > > index af1c76981911..8e0c49105d3e 100644 > > --- a/arch/arm64/include/asm/tlbflush.h > > +++ b/arch/arm64/include/asm/tlbflush.h > > @@ -184,6 +184,14 @@ static inline void flush_tlb_kernel_range(unsigned long start, unsigned long end > > isb(); > > } > > > > +static inline void __flush_tlb_one(unsigned long addr) > > +{ > > + dsb(ishst); > > + __tlbi(vaae1is, addr >> 12); > > + dsb(ish); > > + isb(); > > +} > > Is this going to be called by generic code? Yes, it's called in mm/xpfo.c:xpfo_kunmap. > It would be nice if we could drop 'kernel' into the name, to make it clear this > is intended to affect the kernel mappings, which have different maintenance > requirements to user mappings. > > We should be able to implement this more simply as: > > flush_tlb_kernel_page(unsigned long addr) > { > flush_tlb_kernel_range(addr, addr + PAGE_SIZE); > } It's named __flush_tlb_one after the x86 (and a few other arches) function of the same name. I can change it to flush_tlb_kernel_page, but then we'll need some x86-specific code to map the name as well. Maybe since it's called from generic code that's warranted though? I'll change the implementation for now, let me know what you want to do about the name. Cheers, Tycho