Re: [PATCH 2/2] microblaze: reserve the ABI argument-home area in the signal frame
From: Michal Simek
Date: Fri Jun 05 2026 - 02:49:59 EST
On 6/4/26 17:37, Ramin Moussavi wrote:
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
Actually I have created similar patch a month ago but I have only 7 spaces here.
r15 - r1 + 0
r5 - r1+4
r6 - r1+8
r7 - r1+12
r8 - r1+16
r9 - r1+20
r10 - r1+24
It means 7 should be enough. Can you please retest it?
Thanks,
Michal
--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP/Versal ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal/Versal NET SoCs
TF-A maintainer - Xilinx ZynqMP/Versal/Versal NET SoCs