[PATCH] arm64: Use larger stacks when KASAN is selected

Mark Rutland mark.rutland at arm.com
Wed Oct 4 04:39:09 PDT 2017


On Wed, Oct 04, 2017 at 12:31:31PM +0100, Catalin Marinas wrote:
> On Tue, Oct 03, 2017 at 06:25:46PM +0100, Mark Rutland wrote:
> > AddressSanitizer instrumentation can significantly bloat the stack, and
> > with GCC 7 this can result in stack overflows at boot time in some
> > configurations.
> > 
> > We can avoid this by doubling our stack size when KASAN is in use, as is
> > already done on x86 (and has been since KASAN was introduced).
> > Regardless of other patches to decrease KASAN's stack utilization,
> > kernels built with KASAN will always require more stack space than those
> > built without, and we should take this into account.
> > 
> > Signed-off-by: Mark Rutland <mark.rutland at arm.com>
> > Cc: Catalin Marinas <catalin.marinas at arm.com>
> > Cc: Will Deacon <will.deacon at arm.com>
> > Cc: Suzuki K Poulose <suzuki.poulose at arm.com>
> > ---
> >  arch/arm64/include/asm/memory.h | 9 ++++++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> > 
> > In local testing (with KASAN and other options enabled), I've seen a stack
> > depth of 23928 bytes while booting to a prompt with an Ubuntu 14.04 filesystem
> > mounted over NFS. Without KASAN (but with other debug options enabled), this
> > was 7992 bytes.
> > 
> > I wonder if we want to go for 4x rather than 2x...
> 
> Let's hope it's fine for now with 32K stacks. We may run into allocation
> issues with 64K stacks (and without VMAP_STACKS).
> 
> Do you want this patch for 4.14?

If you're happy to take it, that would be great, but otherwise it can
wait for v4.15.

Arguably this fixes the introduction of KASAN to arm64, but I'm not sure
how much we care about backporting this to stable.

Thanks,
Mark.



More information about the linux-arm-kernel mailing list