[PATCH 2/2] microblaze: reserve the ABI argument-home area in the signal frame
From: Ramin Moussavi
Date: Thu Jun 04 2026 - 11:49:38 EST
The MicroBlaze procedure call standard lets a callee store its incoming
register arguments r5..r10 into the caller-provided home slots at
[r1+4]..[r1+28]. When the kernel enters a signal handler it sets r1 to
point at struct rt_sigframe, whose leading members are the siginfo and
ucontext prepared for the handler. A handler that homes its arguments -
which an unoptimised (-O0) build always does - therefore overwrites the
start of siginfo/ucontext, corrupting the signal state that the handler
and sys_rt_sigreturn() depend on.
Reserve the home area by making an eight-word gap the first member of
struct rt_sigframe, so the handler's argument stores land in scratch space
instead of clobbering siginfo.
Tested on qemu-system-microblazeel (petalogix-s3adsp1800) with the
uClibc-ng NPTL test suite: tst-timer4, tst-timer5, tst-mqueue5 and
tst-signal6 pass; before this change they failed because the handler
clobbered the signal frame.
Signed-off-by: Ramin Moussavi <ramin.moussavi@xxxxxxxxx>
---
arch/microblaze/kernel/signal.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c
index c78a0ff48..df9c07d77 100644
--- a/arch/microblaze/kernel/signal.c
+++ b/arch/microblaze/kernel/signal.c
@@ -49,6 +49,13 @@ struct sigframe {
};
struct rt_sigframe {
+ /*
+ * Home area for the handler's register arguments: the MicroBlaze
+ * ABI lets the callee store r5..r10 at [r1+4]..[r1+28], and r1
+ * points at this frame when the handler is entered. Without the
+ * gap those stores corrupt info/uc.
+ */
+ unsigned long abi_gap[8];
struct siginfo info;
struct ucontext uc;
unsigned long tramp[2]; /* signal trampoline */
--
2.53.0