lkml.org 
[lkml]   [2018]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 2/4] MIPS: Add syscall detection for restartable sequences
----- On Jun 14, 2018, at 7:52 PM, Paul Burton paul.burton@mips.com wrote:

> 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>
> Cc: James Hogan <jhogan@kernel.org>
> 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
> ---
>
> arch/mips/kernel/entry.S | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> 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)
> jal schedule_tail # a0 = struct task_struct *prev
>
> FEXPORT(syscall_exit)
> +#ifdef CONFIG_DEBUG_RSEQ
> + move a0, sp
> + jal rseq_syscall
> +#endif
> local_irq_disable # make sure need_resched and
> # signals dont change between
> # sampling and return
> @@ -141,6 +145,10 @@ work_notifysig: # deal with pending signals and
> j resume_userspace_check
>
> FEXPORT(syscall_exit_partial)
> +#ifdef CONFIG_DEBUG_RSEQ
> + move a0, sp
> + jal rseq_syscall
> +#endif
> local_irq_disable # make sure need_resched doesn't
> # change between and return
> LONG_L a2, TI_FLAGS($28) # current->work

Just to double-check: you did test with CONFIG_DEBUG_RSEQ=y, right ?

Are there any live registers that need to be saved before calling
rseq_syscall ?

Thanks,

Mathieu


--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
\
 
 \ /
  Last update: 2018-06-15 19:41    [W:0.093 / U:0.676 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site