diff options
author | Paul Burton <paul.burton@mips.com> | 2018-06-14 13:20:54 -0400 |
---|---|---|
committer | Paul Burton <paul.burton@mips.com> | 2018-06-20 00:13:56 -0400 |
commit | 9bcf53598dfe1bd8caaf8e03738d3cc51d45904e (patch) | |
tree | ee25419bb284148763c5a9cd2ae30424d006ca44 | |
parent | 9ea141ad54716d48e79d0093052c12ed67debf09 (diff) |
MIPS: Add syscall detection for restartable sequences
Syscalls are not allowed inside restartable sequences, so add a call to
rseq_syscall() at the very beginning of the system call exit path when
CONFIG_DEBUG_RSEQ=y. This will help us to detect whether there is a
syscall issued erroneously inside a restartable sequence.
Signed-off-by: Paul Burton <paul.burton@mips.com>
Reviewed-by: James Hogan <jhogan@kernel.org>
Patchwork: https://patchwork.linux-mips.org/patch/19522/
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
-rw-r--r-- | arch/mips/kernel/entry.S | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/mips/kernel/entry.S b/arch/mips/kernel/entry.S index 38a302919e6b..d7de8adcfcc8 100644 --- a/arch/mips/kernel/entry.S +++ b/arch/mips/kernel/entry.S | |||
@@ -79,6 +79,10 @@ FEXPORT(ret_from_fork) | |||
79 | jal schedule_tail # a0 = struct task_struct *prev | 79 | jal schedule_tail # a0 = struct task_struct *prev |
80 | 80 | ||
81 | FEXPORT(syscall_exit) | 81 | FEXPORT(syscall_exit) |
82 | #ifdef CONFIG_DEBUG_RSEQ | ||
83 | move a0, sp | ||
84 | jal rseq_syscall | ||
85 | #endif | ||
82 | local_irq_disable # make sure need_resched and | 86 | local_irq_disable # make sure need_resched and |
83 | # signals dont change between | 87 | # signals dont change between |
84 | # sampling and return | 88 | # sampling and return |
@@ -141,6 +145,10 @@ work_notifysig: # deal with pending signals and | |||
141 | j resume_userspace_check | 145 | j resume_userspace_check |
142 | 146 | ||
143 | FEXPORT(syscall_exit_partial) | 147 | FEXPORT(syscall_exit_partial) |
148 | #ifdef CONFIG_DEBUG_RSEQ | ||
149 | move a0, sp | ||
150 | jal rseq_syscall | ||
151 | #endif | ||
144 | local_irq_disable # make sure need_resched doesn't | 152 | local_irq_disable # make sure need_resched doesn't |
145 | # change between and return | 153 | # change between and return |
146 | LONG_L a2, TI_FLAGS($28) # current->work | 154 | LONG_L a2, TI_FLAGS($28) # current->work |