[PATCH 2/2] powerpc/64: Increase stack redzone for 64-bit kernel to 512 bytes
Nicholas Piggin
npiggin at gmail.com
Mon Oct 1 09:27:15 AEST 2018
On Sat, 29 Sep 2018 23:25:20 -0700
Bin Meng <bmeng.cn at gmail.com> wrote:
> commit 573ebfa6601f ("powerpc: Increase stack redzone for 64-bit
> userspace to 512 bytes") only changes stack userspace redzone size.
> We need increase the kernel one to 512 bytes too per ABIv2 spec.
You're right we need 512 to be compatible with ABIv2, but as the
comment says, gcc limits this to 288 bytes so that's what is used
to save stack space. We can use a compiler version test to change
this if llvm or a new version of gcc does something different.
Thanks,
Nick
>
> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
> ---
>
> arch/powerpc/include/asm/ptrace.h | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
> index 447cbd1..817be3f 100644
> --- a/arch/powerpc/include/asm/ptrace.h
> +++ b/arch/powerpc/include/asm/ptrace.h
> @@ -30,16 +30,12 @@
> #ifdef __powerpc64__
>
> /*
> - * Size of redzone that userspace is allowed to use below the stack
> + * Size of redzone that kernel/userspace is allowed to use below the stack
> * pointer. This is 288 in the 64-bit big-endian ELF ABI, and 512 in
> * the new ELFv2 little-endian ABI, so we allow the larger amount.
> - *
> - * For kernel code we allow a 288-byte redzone, in order to conserve
> - * kernel stack space; gcc currently only uses 288 bytes, and will
> - * hopefully allow explicit control of the redzone size in future.
> */
> #define USER_REDZONE_SIZE 512
> -#define KERNEL_REDZONE_SIZE 288
> +#define KERNEL_REDZONE_SIZE 512
>
> #define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */
> #define STACK_FRAME_LR_SAVE 2 /* Location of LR in stack frame */
> --
> 2.7.4
>
More information about the Linuxppc-dev
mailing list