summaryrefslogtreecommitdiffstats
path: root/arch/riscv/kernel
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@rivosinc.com>2022-03-22 15:48:59 -0700
committerPalmer Dabbelt <palmer@rivosinc.com>2022-03-22 16:20:37 -0700
commitbbde015227e89f1da21bd3b84523d62c4a445c06 (patch)
tree92f1ed47d77055a7ac9b75edac36a2798677610b /arch/riscv/kernel
parent6ae1af9ca0e81f7123d36eae9bf25de63722fbf6 (diff)
parent6d1a6f464efd596779d1b272b3dc8170c5fa189f (diff)
downloadlinux-bbde015227e89f1da21bd3b84523d62c4a445c06.tar.gz
linux-bbde015227e89f1da21bd3b84523d62c4a445c06.tar.bz2
linux-bbde015227e89f1da21bd3b84523d62c4a445c06.zip
RISC-V: add support for restartable sequences
Add support for RSEQ, restartable sequences, for RISC-V. This also adds support for the related selftests. Note: the selftests require a linker with 3e7bd7f2414 ("RISC-V: Fix linker problems with tls copy relocs."), which was first released in 2.33 (from 2019). * palmer/riscv-rseq: rseq/selftests: Add support for RISC-V RISC-V: Add support for restartable sequence
Diffstat (limited to 'arch/riscv/kernel')
-rw-r--r--arch/riscv/kernel/entry.S4
-rw-r--r--arch/riscv/kernel/signal.c2
2 files changed, 6 insertions, 0 deletions
diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S
index ed29e9c8f660..56ada2a583fa 100644
--- a/arch/riscv/kernel/entry.S
+++ b/arch/riscv/kernel/entry.S
@@ -225,6 +225,10 @@ ret_from_syscall:
* (If it was configured with SECCOMP_RET_ERRNO/TRACE)
*/
ret_from_syscall_rejected:
+#ifdef CONFIG_DEBUG_RSEQ
+ move a0, sp
+ call rseq_syscall
+#endif
/* Trace syscalls, but only if requested by the user. */
REG_L t0, TASK_TI_FLAGS(tp)
andi t0, t0, _TIF_SYSCALL_WORK
diff --git a/arch/riscv/kernel/signal.c b/arch/riscv/kernel/signal.c
index c2d5ecbe5526..16da3c3b53a1 100644
--- a/arch/riscv/kernel/signal.c
+++ b/arch/riscv/kernel/signal.c
@@ -258,6 +258,8 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs)
}
}
+ rseq_signal_deliver(ksig, regs);
+
/* Set up the stack frame */
ret = setup_rt_frame(ksig, oldset, regs);