All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] riscv: fix a nasty sigreturn bug...
@ 2021-09-24  1:55 ` Al Viro
  0 siblings, 0 replies; 10+ messages in thread
From: Al Viro @ 2021-09-24  1:55 UTC (permalink / raw)
  To: linux-riscv; +Cc: Linus Torvalds, linux-kernel

riscv has an equivalent of arm bug fixed by 653d48b22166; if signal
gets caught by an interrupt that hits when we have the right value
in a0 (-513), *and* another signal gets delivered upon sigreturn()
(e.g. included into the blocked mask for the first signal and posted
while the handler had been running), the syscall restart logics will
see regs->cause equal to EXC_SYSCALL (we are in a syscall, after all)
and a0 already restored to its original value (-513, which happens to
be -ERESTARTNOINTR) and assume that we need to apply the usual
syscall restart logics.
    
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/arch/riscv/kernel/signal.c b/arch/riscv/kernel/signal.c
index c2d5ecbe55264..f8fb85dc94b7a 100644
--- a/arch/riscv/kernel/signal.c
+++ b/arch/riscv/kernel/signal.c
@@ -121,6 +121,8 @@ SYSCALL_DEFINE0(rt_sigreturn)
 	if (restore_altstack(&frame->uc.uc_stack))
 		goto badframe;
 
+	regs->cause = -1UL;
+
 	return regs->a0;
 
 badframe:

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-09-15 18:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-24  1:55 [PATCH] riscv: fix a nasty sigreturn bug Al Viro
2021-09-24  1:55 ` Al Viro
2022-09-02  0:13 ` Al Viro
2022-09-02  0:13   ` Al Viro
2022-09-02  9:22 ` Andrew Jones
2022-09-02  9:22   ` Andrew Jones
2022-09-02 17:59   ` Al Viro
2022-09-02 17:59     ` Al Viro
2022-09-15 18:48     ` Palmer Dabbelt
2022-09-15 18:48       ` Palmer Dabbelt

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.