lkml.org 
[lkml]   [2018]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH] rseq: Avoid infinite recursion when delivering SIGSEGV
On Wed, Jun 20, 2018 at 12:55:35PM -0400, Mathieu Desnoyers wrote:
> ----- On Jun 20, 2018, at 12:36 PM, Will Deacon will.deacon@arm.com wrote:
>
> > When delivering a signal to a task that is using rseq, we call into
> > __rseq_handle_notify_resume() so that the registers pushed in the
> > sigframe are updated to reflect the state of the restartable sequence
> > (for example, ensuring that the signal returns to the abort handler if
> > necessary).
> >
> > However, if the rseq management fails due to an unrecoverable fault when
> > accessing userspace or certain combinations of RSEQ_CS_* flags, then we
> > will attempt to deliver a SIGSEGV. This has the potential for infinite
> > recursion if the rseq code continuously fails on signal delivery.
> >
> > Avoid this problem by using force_sigsegv() instead of force_sig(), which
> > is explicitly designed to reset the SEGV handler to SIG_DFL in the case
> > of a recursive fault.
>
> Your approach looks good. One nit below implementation-wise:

Nit accepted :) v2 on its way.

Will

\
 
 \ /
  Last update: 2018-06-21 13:53    [W:0.048 / U:0.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site