[PATCH] arm64: signal: reduce stack usage in rt_sigreturn
Arnd Bergmann
arnd at kernel.org
Tue Dec 1 01:08:58 PST 2026
From: Arnd Bergmann <arnd at arndb.de>
The floating point register state is rather large, and clang may end up
putting both the fpsimd and sve version on the same stack, which ends
up larger than most functions:
arch/arm64/kernel/signal.c:1112:1: error: stack frame size (1376) exceeds limit (1280) in '__arm64_sys_rt_sigreturn' [-Werror,-Wframe-larger-than]
1112 | SYSCALL_DEFINE0(rt_sigreturn)
| ^
Since only ever one of the two functions is called here, mark them
both noinline to ensure that the stack usage stays as low as possible.
There is no risk of actually overflowing the kernel stack here, but
addressing the warning helps find real bugs elsewhere if we can reduce
the warning limit.
Signed-off-by: Arnd Bergmann <arnd at arndb.de>
---
arch/arm64/kernel/signal.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index 80398ac83c3b..38774fcd0033 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -313,7 +313,7 @@ static int read_fpsimd_context(struct user_fpsimd_state *fpsimd,
return err ? -EFAULT : 0;
}
-static int restore_fpsimd_context(struct user_ctxs *user)
+static noinline_for_stack int restore_fpsimd_context(struct user_ctxs *user)
{
struct user_fpsimd_state fpsimd;
int err;
@@ -427,7 +427,7 @@ static int preserve_sve_context(struct sve_context __user *ctx)
return err ? -EFAULT : 0;
}
-static int restore_sve_fpsimd_context(struct user_ctxs *user)
+static noinline_for_stack int restore_sve_fpsimd_context(struct user_ctxs *user)
{
int err = 0;
unsigned int vl, vq;
--
2.53.0
More information about the linux-arm-kernel
mailing list