diff options
author | Guo Ren <guoren@linux.alibaba.com> | 2019-11-05 09:58:33 +0800 |
---|---|---|
committer | Guo Ren <guoren@linux.alibaba.com> | 2020-03-08 20:55:14 +0800 |
commit | 9866d141a0977ace974400bf1f793dfc163409ce (patch) | |
tree | 44058c31b3030ac4c6ba5836e3f040f7bbc99d2d /arch/csky/kernel/signal.c | |
parent | bfe47f358ad298a1efb9b8f8299a81541d90df87 (diff) |
csky: Add support for restartable sequence
Copied and adapted from vincent's patch, but modified for csky.
ref:
https://lore.kernel.org/linux-riscv/1572919114-3886-3-git-send-email-vincent.chen@sifive.com/raw
Add calls to rseq_signal_deliver(), rseq_handle_notify_resume() and
rseq_syscall() to introduce RSEQ support.
1. Call the rseq_handle_notify_resume() function on return to userspace
if TIF_NOTIFY_RESUME thread flag is set.
2. Call the rseq_signal_deliver() function to fixup on the pre-signal
frame when a signal is delivered on top of a restartable sequence
critical section.
3. Check that system calls are not invoked from within rseq critical
sections by invoking rseq_signal() from ret_from_syscall(). With
CONFIG_DEBUG_RSEQ, such behavior results in termination of the
process with SIGSEGV.
Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Diffstat (limited to 'arch/csky/kernel/signal.c')
-rw-r--r-- | arch/csky/kernel/signal.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/csky/kernel/signal.c b/arch/csky/kernel/signal.c index 9b1b7c039ddf..3d6b728cbb72 100644 --- a/arch/csky/kernel/signal.c +++ b/arch/csky/kernel/signal.c @@ -175,6 +175,8 @@ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs) sigset_t *oldset = sigmask_to_save(); int ret; + rseq_signal_deliver(ksig, regs); + /* Are we from a system call? */ if (in_syscall(regs)) { /* Avoid additional syscall restarting via ret_from_exception */ @@ -258,5 +260,6 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, if (thread_info_flags & _TIF_NOTIFY_RESUME) { clear_thread_flag(TIF_NOTIFY_RESUME); tracehook_notify_resume(regs); + rseq_handle_notify_resume(NULL, regs); } } |