aboutsummaryrefslogtreecommitdiffstats
path: root/arch/riscv/kernel/signal.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2021-09-24 01:55:27 +0000
committerPalmer Dabbelt <palmer@rivosinc.com>2022-09-17 01:48:23 -0700
commit762df359aa5849e010ef04c3ed79d57588ce17d9 (patch)
treedbdd3caaaf579f180bb37e7ebcef367b690dbc16 /arch/riscv/kernel/signal.c
parentriscv: make t-head erratas depend on MMU (diff)
downloadlinux-dev-762df359aa5849e010ef04c3ed79d57588ce17d9.tar.xz
linux-dev-762df359aa5849e010ef04c3ed79d57588ce17d9.zip
riscv: fix a nasty sigreturn bug...
riscv has an equivalent of arm bug fixed by 653d48b22166 ("arm: fix really nasty sigreturn bug"); 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> Fixes: e2c0cdfba7f6 ("RISC-V: User-facing API") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/YxJEiSq%2FCGaL6Gm9@ZenIV/ Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diffstat (limited to 'arch/riscv/kernel/signal.c')
-rw-r--r--arch/riscv/kernel/signal.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/riscv/kernel/signal.c b/arch/riscv/kernel/signal.c
index 5a2de6b6f882..5c591123c440 100644
--- a/arch/riscv/kernel/signal.c
+++ b/arch/riscv/kernel/signal.c
@@ -124,6 +124,8 @@ SYSCALL_DEFINE0(rt_sigreturn)
if (restore_altstack(&frame->uc.uc_stack))
goto badframe;
+ regs->cause = -1UL;
+
return regs->a0;
badframe: