Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: signal: reduce stack usage in rt_sigreturn
@ 2026-12-01  9:08 Arnd Bergmann
  0 siblings, 0 replies; only message in thread
From: Arnd Bergmann @ 2026-12-01  9:08 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Nathan Chancellor
  Cc: Arnd Bergmann, Mark Rutland, Nick Desaulniers, Bill Wendling,
	Justin Stitt, Mark Brown, Kevin Brodsky, linux-arm-kernel, llvm

From: Arnd Bergmann <arnd@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@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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-01  9:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01  9:08 [PATCH] arm64: signal: reduce stack usage in rt_sigreturn Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox