[PATCH] arm64: kasan: mte: move GCR_EL1 switch to task switch when KASAN disabled

Catalin Marinas catalin.marinas at arm.com
Mon Sep 6 10:58:26 PDT 2021


On Thu, Aug 26, 2021 at 08:07:48PM -0700, Peter Collingbourne wrote:
> It is not necessary to write to GCR_EL1 on every kernel entry and
> exit when HW tag-based KASAN is disabled because the kernel will not
> execute any IRG instructions in that mode. Since accessing GCR_EL1
> can be expensive on some microarchitectures, avoid doing so by moving
> the access to task switch when HW tag-based KASAN is disabled.

I haven't got a chance to look at this patch yet as it was posted pretty
close to the merging window, so it wasn't on my urgent list (not a fix).

What's the use-case exactly? Do you expect production kernels to have
KASAN_HW built in but disabled on the command line? I thought there's an
overhead already from kasan even without MTE.

-- 
Catalin



More information about the linux-arm-kernel mailing list