From mboxrd@z Thu Jan 1 00:00:00 1970 From: will.deacon@arm.com (Will Deacon) Date: Mon, 15 Aug 2016 12:02:54 +0100 Subject: [kernel-hardening] [PATCH 0/7] arm64: Privileged Access Never using TTBR0_EL1 switching In-Reply-To: References: <20160815095813.GA1996@svinekod> <20160815100649.GB1996@svinekod> <20160815103000.GE13262@arm.com> <20160815103721.GF13262@arm.com> <20160815105205.GD22320@e104818-lin.cambridge.arm.com> Message-ID: <20160815110253.GH13262@arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Mon, Aug 15, 2016 at 12:56:58PM +0200, Ard Biesheuvel wrote: > On 15 August 2016 at 12:52, Catalin Marinas wrote: > > On Mon, Aug 15, 2016 at 12:43:31PM +0200, Ard Biesheuvel wrote: > >> But, how about we store the reserved ASID in TTBR1_EL1 instead, and > >> switch TCR_EL1.A1 and TCR_EL1.EPD0 in a single write? That way, we can > >> switch ASIDs and disable table walks atomically (I hope), and we > >> wouldn't need to change TTBR0_EL1 at all. > > > > I did this before for AArch32 + LPAE (patches on the list sometime last > > year I think). But the idea was nak'ed by the ARM architects. The > > TCR_EL1.A1 can be cached somewhere in the TLB state machine, so you need > > TLBI (IOW, toggling A1 does not guarantee an ASID switch). > > > > But how is TTBR0_EL1 any different? The ARM ARM equally mentions that > any of its field can be cached in a TLB, so by that reasoning, setting > a new ASID in TTBR0_EL1 would also require TLB maintenance. The underlying issue is that "cached in a TLB" doesn't distinguish between "cached in a TLB *entry*" and "cached by the logic used to form TLB entries" (i.e. the table walker). That's where we need to seek clarification from the architects, because existing microarchitectures do utilise both of these types of caching. Will