[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180621145715.GF22505@arm.com>
Date: Thu, 21 Jun 2018 15:57:16 +0100
From: Will Deacon <will.deacon@....com>
To: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: linux-kernel <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Boqun Feng <boqun.feng@...il.com>,
Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH v2] rseq: Avoid infinite recursion when delivering SIGSEGV
On Thu, Jun 21, 2018 at 10:44:37AM -0400, Mathieu Desnoyers wrote:
> ----- On Jun 21, 2018, at 7:54 AM, Will Deacon will.deacon@....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. In doing so, remove rseq_signal_deliver() from the
> > internal rseq API and have an optional struct ksignal * parameter to
> > rseq_handle_notify_resume() instead.
> >
> > Signed-off-by: Will Deacon <will.deacon@....com>
> > ---
> >
> > RFC v1 -> v2: Kill rseq_signal_deliver()
>
> I actually meant to kill _rseq_handle_notify_resume introduced by
> your patch, not rseq_signal_deliver().
>
> Please keep rseq_signal_deliver() as a static inline, and just remove
> the _rseq_handle_notify_resume() by changing the signature of
> rseq_handle_notify_resume to take an extra sig argument (which can
> be NULL).
Sorry, I misunderstood what you were asking for. I'll spin a v3 in a bit
with rseq_signal_deliver() reintroduced.
Will
Powered by blists - more mailing lists