Re: [PATCH v14 2/4] kasan: allow architectures to provide an outline readiness check

From: Christophe Leroy
Date: Thu Jun 17 2021 - 02:55:49 EST




Le 17/06/2021 à 08:39, Daniel Axtens a écrit :
Allow architectures to define a kasan_arch_is_ready() hook that bails
out of any function that's about to touch the shadow unless the arch
says that it is ready for the memory to be accessed. This is fairly
uninvasive and should have a negligible performance penalty.

This will only work in outline mode, so an arch must specify
ARCH_DISABLE_KASAN_INLINE if it requires this.

Cc: Balbir Singh <bsingharora@xxxxxxxxx>
Cc: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxxxxxxx>
Suggested-by: Christophe Leroy <christophe.leroy@xxxxxxxxxx>
Signed-off-by: Daniel Axtens <dja@xxxxxxxxxx>

--

Both previous RFCs for ppc64 - by 2 different people - have
needed this trick! See:
- https://lore.kernel.org/patchwork/patch/592820/ # ppc64 hash series
- https://patchwork.ozlabs.org/patch/795211/ # ppc radix series

I haven't been able to exercise the arch hook error for !GENERIC as I
don't have a particularly modern aarch64 toolchain or a lot of experience
cross-compiling with clang. But it does fire for GENERIC + INLINE on x86.

Modern toolchains are available here https://mirrors.edge.kernel.org/pub/tools/crosstool/