* [PATCH 0/2] microblaze: fix signal-frame handling for NPTL
@ 2026-06-04 15:37 Ramin Moussavi
2026-06-04 15:37 ` [PATCH 1/2] microblaze: wire up sigaltstack Ramin Moussavi
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Ramin Moussavi @ 2026-06-04 15:37 UTC (permalink / raw)
To: Michal Simek; +Cc: linux-kernel, Ramin Moussavi
Two independent fixes to the microblaze signal-delivery path, both found
while bringing the uClibc-ng NPTL test suite up on microblazeel under
qemu-system (petalogix-s3adsp1800).
Patch 1 wires up sigaltstack(), which is currently routed to
sys_ni_syscall even though the signal code fully supports an alternate
stack - microblaze is the only architecture leaving it unimplemented.
Patch 2 reserves the ABI argument-home area at the top of the signal
frame. The MicroBlaze calling convention lets a handler store its
incoming register arguments into [r1+4]..[r1+28]; since r1 points at
struct rt_sigframe on entry, those stores land in siginfo/ucontext and
corrupt the signal state. An eight-word leading gap moves them into
scratch space.
Both were tested with the uClibc-ng NPTL tests; the affected tests
(tst-cancel20/21, tst-cancelx20/21, tst-signal6, tst-timer4/5,
tst-mqueue5) now pass. checkpatch --strict is clean and both apply to
current linux-next.
Ramin Moussavi (2):
microblaze: wire up sigaltstack
microblaze: reserve the ABI argument-home area in the signal frame
arch/microblaze/kernel/signal.c | 7 +++++++
arch/microblaze/kernel/syscalls/syscall.tbl | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] microblaze: wire up sigaltstack
2026-06-04 15:37 [PATCH 0/2] microblaze: fix signal-frame handling for NPTL Ramin Moussavi
@ 2026-06-04 15:37 ` Ramin Moussavi
2026-06-04 15:37 ` [PATCH 2/2] microblaze: reserve the ABI argument-home area in the signal frame Ramin Moussavi
2026-06-05 8:20 ` [PATCH v2 0/2] microblaze: fix signal-frame handling for NPTL Ramin Moussavi
2 siblings, 0 replies; 9+ messages in thread
From: Ramin Moussavi @ 2026-06-04 15:37 UTC (permalink / raw)
To: Michal Simek; +Cc: linux-kernel, Ramin Moussavi, Ramin Moussavi
sigaltstack is wired to sys_ni_syscall - microblaze is the only
architecture without it - although the microblaze signal delivery code
fully supports the alternate signal stack: get_sigframe() picks the
stack via sigsp(), setup_rt_frame() saves it with __save_altstack() and
sys_rt_sigreturn() calls restore_altstack().
Wire it up to sys_sigaltstack.
Tested on qemu petalogix-s3adsp1800 (microblazeel) with the uClibc-ng
test suite: the five sigaltstack-dependent NPTL tests (tst-cancel20/21,
tst-cancelx20/21, tst-signal6) pass; before this change sigaltstack()
returned ENOSYS.
Signed-off-by: Ramin Moussavi <ramin.moussavi@yacoub.de>
---
arch/microblaze/kernel/syscalls/syscall.tbl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/microblaze/kernel/syscalls/syscall.tbl b/arch/microblaze/kernel/syscalls/syscall.tbl
index 223d26303..b4ce48e8a 100644
--- a/arch/microblaze/kernel/syscalls/syscall.tbl
+++ b/arch/microblaze/kernel/syscalls/syscall.tbl
@@ -193,7 +193,7 @@
183 common getcwd sys_getcwd
184 common capget sys_capget
185 common capset sys_capset
-186 common sigaltstack sys_ni_syscall
+186 common sigaltstack sys_sigaltstack
187 common sendfile sys_sendfile
188 common getpmsg sys_ni_syscall
189 common putpmsg sys_ni_syscall
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] microblaze: reserve the ABI argument-home area in the signal frame
2026-06-04 15:37 [PATCH 0/2] microblaze: fix signal-frame handling for NPTL Ramin Moussavi
2026-06-04 15:37 ` [PATCH 1/2] microblaze: wire up sigaltstack Ramin Moussavi
@ 2026-06-04 15:37 ` Ramin Moussavi
2026-06-05 6:42 ` Michal Simek
2026-06-05 8:20 ` [PATCH v2 0/2] microblaze: fix signal-frame handling for NPTL Ramin Moussavi
2 siblings, 1 reply; 9+ messages in thread
From: Ramin Moussavi @ 2026-06-04 15:37 UTC (permalink / raw)
To: Michal Simek; +Cc: linux-kernel, Ramin Moussavi, Ramin Moussavi
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@yacoub.de>
---
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] microblaze: reserve the ABI argument-home area in the signal frame
2026-06-04 15:37 ` [PATCH 2/2] microblaze: reserve the ABI argument-home area in the signal frame Ramin Moussavi
@ 2026-06-05 6:42 ` Michal Simek
[not found] ` <CAJxQxNCFym69FGxuDh_1gt+v91btBq3bvEnc=5eSApfMP=3pAA@mail.gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: Michal Simek @ 2026-06-05 6:42 UTC (permalink / raw)
To: Ramin Moussavi; +Cc: linux-kernel, Ramin Moussavi
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@yacoub.de>
> ---
> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] microblaze: reserve the ABI argument-home area in the signal frame
[not found] ` <CAJxQxNCFym69FGxuDh_1gt+v91btBq3bvEnc=5eSApfMP=3pAA@mail.gmail.com>
@ 2026-06-05 7:54 ` Michal Simek
0 siblings, 0 replies; 9+ messages in thread
From: Michal Simek @ 2026-06-05 7:54 UTC (permalink / raw)
To: Ramin Moussavi; +Cc: linux-kernel, Ramin Moussavi
Hi,
On 6/5/26 09:24, Ramin Moussavi wrote:
> Hi Michal,
>
please avoid top posting next time.
> You're right, 7 is enough - the home area is exactly r15 at r1+0 and
> r5..r10 at r1+4..r1+24. I only picked 8 because it looked like a rounder
> number than 7; the 8th word is never written by the ABI, so 7 is the
> correct minimal size. Please go ahead with your version.
you are sending 2 patches. Just send a v2 version that should be fine with
updated value.
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 0/2] microblaze: fix signal-frame handling for NPTL
2026-06-04 15:37 [PATCH 0/2] microblaze: fix signal-frame handling for NPTL Ramin Moussavi
2026-06-04 15:37 ` [PATCH 1/2] microblaze: wire up sigaltstack Ramin Moussavi
2026-06-04 15:37 ` [PATCH 2/2] microblaze: reserve the ABI argument-home area in the signal frame Ramin Moussavi
@ 2026-06-05 8:20 ` Ramin Moussavi
2026-06-05 8:20 ` [PATCH v2 1/2] microblaze: wire up sigaltstack Ramin Moussavi
` (2 more replies)
2 siblings, 3 replies; 9+ messages in thread
From: Ramin Moussavi @ 2026-06-05 8:20 UTC (permalink / raw)
To: Michal Simek; +Cc: linux-kernel, Ramin Moussavi
Two independent fixes to the microblaze signal-delivery path, both found
while bringing the uClibc-ng NPTL test suite up on microblazeel under
qemu-system (petalogix-s3adsp1800).
Patch 1 wires up sigaltstack(), which is currently routed to
sys_ni_syscall even though the signal code fully supports an alternate
stack - microblaze is the only architecture leaving it unimplemented.
Patch 2 reserves the ABI argument-home area at the top of the signal
frame. The MicroBlaze calling convention reserves [r1+0] for the return
address and lets a handler store its incoming register arguments r5..r10
into [r1+4]..[r1+24]; since r1 points at struct rt_sigframe on entry,
those stores land in siginfo/ucontext and corrupt the signal state. A
seven-word leading gap moves them into scratch space.
Both were tested with the uClibc-ng NPTL tests; the affected tests
(tst-cancel20/21, tst-cancelx20/21, tst-signal6, tst-timer4/5,
tst-mqueue5) pass. checkpatch --strict is clean and both apply to
current linux-next.
Changes since v1 [1]:
- Patch 2: shrink the gap from eight to seven words. Michal pointed
out that the home area is exactly seven words (r15 at r1+0, r5..r10
at r1+4..r1+24); the eighth word was never written by the ABI.
Retested on qemu - tst-timer4/5, tst-mqueue5, tst-signal6 still pass.
- Patch 2: fix the offset range in the commit message and the in-code
comment ([r1+4]..[r1+24], not [r1+28]).
- Patch 1: unchanged.
[1] https://lore.kernel.org/all/cover.1780587199.git.lordrasmus@gmail.com/
Ramin Moussavi (2):
microblaze: wire up sigaltstack
microblaze: reserve the ABI argument-home area in the signal frame
arch/microblaze/kernel/signal.c | 8 ++++++++
arch/microblaze/kernel/syscalls/syscall.tbl | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 1/2] microblaze: wire up sigaltstack
2026-06-05 8:20 ` [PATCH v2 0/2] microblaze: fix signal-frame handling for NPTL Ramin Moussavi
@ 2026-06-05 8:20 ` Ramin Moussavi
2026-06-05 8:20 ` [PATCH v2 2/2] microblaze: reserve the ABI argument-home area in the signal frame Ramin Moussavi
2026-06-05 8:34 ` [PATCH v2 0/2] microblaze: fix signal-frame handling for NPTL Michal Simek
2 siblings, 0 replies; 9+ messages in thread
From: Ramin Moussavi @ 2026-06-05 8:20 UTC (permalink / raw)
To: Michal Simek; +Cc: linux-kernel, Ramin Moussavi, Ramin Moussavi
sigaltstack is wired to sys_ni_syscall - microblaze is the only
architecture without it - although the microblaze signal delivery code
fully supports the alternate signal stack: get_sigframe() picks the
stack via sigsp(), setup_rt_frame() saves it with __save_altstack() and
sys_rt_sigreturn() calls restore_altstack().
Wire it up to sys_sigaltstack.
Tested on qemu petalogix-s3adsp1800 (microblazeel, kernel 6.5.10 and
syscall table unchanged in current mainline) with the uClibc-ng test
suite: the five sigaltstack-dependent NPTL tests (tst-cancel20/21,
tst-cancelx20/21, tst-signal6) pass; before this change sigaltstack()
returned ENOSYS.
Signed-off-by: Ramin Moussavi <ramin.moussavi@yacoub.de>
---
arch/microblaze/kernel/syscalls/syscall.tbl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/microblaze/kernel/syscalls/syscall.tbl b/arch/microblaze/kernel/syscalls/syscall.tbl
index 223d26303..b4ce48e8a 100644
--- a/arch/microblaze/kernel/syscalls/syscall.tbl
+++ b/arch/microblaze/kernel/syscalls/syscall.tbl
@@ -193,7 +193,7 @@
183 common getcwd sys_getcwd
184 common capget sys_capget
185 common capset sys_capset
-186 common sigaltstack sys_ni_syscall
+186 common sigaltstack sys_sigaltstack
187 common sendfile sys_sendfile
188 common getpmsg sys_ni_syscall
189 common putpmsg sys_ni_syscall
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 2/2] microblaze: reserve the ABI argument-home area in the signal frame
2026-06-05 8:20 ` [PATCH v2 0/2] microblaze: fix signal-frame handling for NPTL Ramin Moussavi
2026-06-05 8:20 ` [PATCH v2 1/2] microblaze: wire up sigaltstack Ramin Moussavi
@ 2026-06-05 8:20 ` Ramin Moussavi
2026-06-05 8:34 ` [PATCH v2 0/2] microblaze: fix signal-frame handling for NPTL Michal Simek
2 siblings, 0 replies; 9+ messages in thread
From: Ramin Moussavi @ 2026-06-05 8:20 UTC (permalink / raw)
To: Michal Simek; +Cc: linux-kernel, Ramin Moussavi, Ramin Moussavi
The MicroBlaze procedure call standard reserves [r1+0] for the return
address and lets a callee store its incoming register arguments r5..r10
into the caller-provided home slots at [r1+4]..[r1+24]. 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 a seven-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@yacoub.de>
---
arch/microblaze/kernel/signal.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c
index c78a0ff48..9cca06d60 100644
--- a/arch/microblaze/kernel/signal.c
+++ b/arch/microblaze/kernel/signal.c
@@ -49,6 +49,14 @@ struct sigframe {
};
struct rt_sigframe {
+ /*
+ * Home area for the handler's register arguments: the MicroBlaze
+ * ABI reserves [r1+0] for the return address and lets the callee
+ * store r5..r10 at [r1+4]..[r1+24], and r1 points at this frame
+ * when the handler is entered. Without the gap those stores
+ * corrupt info/uc.
+ */
+ unsigned long abi_gap[7];
struct siginfo info;
struct ucontext uc;
unsigned long tramp[2]; /* signal trampoline */
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 0/2] microblaze: fix signal-frame handling for NPTL
2026-06-05 8:20 ` [PATCH v2 0/2] microblaze: fix signal-frame handling for NPTL Ramin Moussavi
2026-06-05 8:20 ` [PATCH v2 1/2] microblaze: wire up sigaltstack Ramin Moussavi
2026-06-05 8:20 ` [PATCH v2 2/2] microblaze: reserve the ABI argument-home area in the signal frame Ramin Moussavi
@ 2026-06-05 8:34 ` Michal Simek
2 siblings, 0 replies; 9+ messages in thread
From: Michal Simek @ 2026-06-05 8:34 UTC (permalink / raw)
To: Ramin Moussavi; +Cc: linux-kernel
On 6/5/26 10:20, Ramin Moussavi wrote:
> Two independent fixes to the microblaze signal-delivery path, both found
> while bringing the uClibc-ng NPTL test suite up on microblazeel under
> qemu-system (petalogix-s3adsp1800).
>
> Patch 1 wires up sigaltstack(), which is currently routed to
> sys_ni_syscall even though the signal code fully supports an alternate
> stack - microblaze is the only architecture leaving it unimplemented.
>
> Patch 2 reserves the ABI argument-home area at the top of the signal
> frame. The MicroBlaze calling convention reserves [r1+0] for the return
> address and lets a handler store its incoming register arguments r5..r10
> into [r1+4]..[r1+24]; since r1 points at struct rt_sigframe on entry,
> those stores land in siginfo/ucontext and corrupt the signal state. A
> seven-word leading gap moves them into scratch space.
>
> Both were tested with the uClibc-ng NPTL tests; the affected tests
> (tst-cancel20/21, tst-cancelx20/21, tst-signal6, tst-timer4/5,
> tst-mqueue5) pass. checkpatch --strict is clean and both apply to
> current linux-next.
>
> Changes since v1 [1]:
> - Patch 2: shrink the gap from eight to seven words. Michal pointed
> out that the home area is exactly seven words (r15 at r1+0, r5..r10
> at r1+4..r1+24); the eighth word was never written by the ABI.
> Retested on qemu - tst-timer4/5, tst-mqueue5, tst-signal6 still pass.
> - Patch 2: fix the offset range in the commit message and the in-code
> comment ([r1+4]..[r1+24], not [r1+28]).
> - Patch 1: unchanged.
>
> [1] https://lore.kernel.org/all/cover.1780587199.git.lordrasmus@gmail.com/
>
> Ramin Moussavi (2):
> microblaze: wire up sigaltstack
> microblaze: reserve the ABI argument-home area in the signal frame
>
> arch/microblaze/kernel/signal.c | 8 ++++++++
> arch/microblaze/kernel/syscalls/syscall.tbl | 2 +-
> 2 files changed, 9 insertions(+), 1 deletion(-)
>
2 issues here.
1. Do not send it as reply to v1 but separately.
2. Author of patch is not matching SOB in the email
You are sending it from
Ramin Moussavi <lordrasmus@gmail.com>
and SOB has
Ramin Moussavi <ramin.moussavi@yacoub.de>
Please fix it and send v3
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
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-06-05 8:34 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-04 15:37 [PATCH 0/2] microblaze: fix signal-frame handling for NPTL Ramin Moussavi
2026-06-04 15:37 ` [PATCH 1/2] microblaze: wire up sigaltstack Ramin Moussavi
2026-06-04 15:37 ` [PATCH 2/2] microblaze: reserve the ABI argument-home area in the signal frame Ramin Moussavi
2026-06-05 6:42 ` Michal Simek
[not found] ` <CAJxQxNCFym69FGxuDh_1gt+v91btBq3bvEnc=5eSApfMP=3pAA@mail.gmail.com>
2026-06-05 7:54 ` Michal Simek
2026-06-05 8:20 ` [PATCH v2 0/2] microblaze: fix signal-frame handling for NPTL Ramin Moussavi
2026-06-05 8:20 ` [PATCH v2 1/2] microblaze: wire up sigaltstack Ramin Moussavi
2026-06-05 8:20 ` [PATCH v2 2/2] microblaze: reserve the ABI argument-home area in the signal frame Ramin Moussavi
2026-06-05 8:34 ` [PATCH v2 0/2] microblaze: fix signal-frame handling for NPTL Michal Simek
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.