]> git.itanic.dy.fi Git - linux-stable/commit
riscv: fix a nasty sigreturn bug...
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 24 Sep 2021 01:55:27 +0000 (01:55 +0000)
committerPalmer Dabbelt <palmer@rivosinc.com>
Sat, 17 Sep 2022 08:48:23 +0000 (01:48 -0700)
commit762df359aa5849e010ef04c3ed79d57588ce17d9
treedbdd3caaaf579f180bb37e7ebcef367b690dbc16
parent2a2018c3ac84c2dc7cfbad117ce9339ea0914622
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>
arch/riscv/kernel/signal.c