Return-Path: Received: from mail-lf1-f67.google.com ([209.85.167.67]:34425 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387873AbeKFESl (ORCPT ); Mon, 5 Nov 2018 23:18:41 -0500 Received: by mail-lf1-f67.google.com with SMTP id n26-v6so6974978lfl.1 for ; Mon, 05 Nov 2018 10:57:38 -0800 (PST) From: Max Filippov To: linux-xtensa@linux-xtensa.org Cc: Chris Zankel , Max Filippov , stable@vger.kernel.org Subject: [PATCH] xtensa: make sure bFLT stack is 16 byte aligned Date: Mon, 5 Nov 2018 10:57:24 -0800 Message-Id: <20181105185724.4187-1-jcmvbkbc@gmail.com> Sender: stable-owner@vger.kernel.org List-ID: Xtensa ABI requires stack alignment to be at least 16. In noMMU configuration ARCH_SLAB_MINALIGN is used to align stack. Make it at least 16. This fixes the following runtime error in noMMU configuration, caused by interaction between insufficiently aligned stack and alloca function, that results in corruption of on-stack variable in the libc function glob: Caught unhandled exception in 'sh' (pid = 47, pc = 0x02d05d65) - should not happen EXCCAUSE is 15 Cc: stable@vger.kernel.org Signed-off-by: Max Filippov --- arch/xtensa/include/asm/processor.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h index e4ccb88b7996..677bc76c1d70 100644 --- a/arch/xtensa/include/asm/processor.h +++ b/arch/xtensa/include/asm/processor.h @@ -23,7 +23,11 @@ # error Linux requires the Xtensa Windowed Registers Option. #endif -#define ARCH_SLAB_MINALIGN XCHAL_DATA_WIDTH +/* Xtensa ABI requires stack alignment to be at least 16 */ + +#define STACK_ALIGN (XCHAL_DATA_WIDTH > 16 ? XCHAL_DATA_WIDTH : 16) + +#define ARCH_SLAB_MINALIGN STACK_ALIGN /* * User space process size: 1 GB. -- 2.11.0