Skip to content

Commit 9bcf535

Browse files
committed
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
1 parent 9ea141a commit 9bcf535

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎arch/mips/kernel/entry.S‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ FEXPORT(ret_from_fork)
7979
jal schedule_tail # a0 = struct task_struct *prev
8080

8181
FEXPORT(syscall_exit)
82+
#ifdef CONFIG_DEBUG_RSEQ
83+
move a0, sp
84+
jal rseq_syscall
85+
#endif
8286
local_irq_disable # make sure need_resched and
8387
# signals dont change between
8488
# sampling and return
@@ -141,6 +145,10 @@ work_notifysig: # deal with pending signals and
141145
j resume_userspace_check
142146

143147
FEXPORT(syscall_exit_partial)
148+
#ifdef CONFIG_DEBUG_RSEQ
149+
move a0, sp
150+
jal rseq_syscall
151+
#endif
144152
local_irq_disable # make sure need_resched doesn't
145153
# change between and return
146154
LONG_L a2, TI_FLAGS($28) # current->work

0 commit comments

Comments
 (0)