public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Boqun Feng <boqun.feng@gmail.com>, Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH v2] rseq: Avoid infinite recursion when delivering SIGSEGV
Date: Thu, 21 Jun 2018 15:57:16 +0100	[thread overview]
Message-ID: <20180621145715.GF22505@arm.com> (raw)
In-Reply-To: <92378910.863.1529592277773.JavaMail.zimbra@efficios.com>

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@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. 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@arm.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

      reply	other threads:[~2018-06-21 14:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-21 11:54 [PATCH v2] rseq: Avoid infinite recursion when delivering SIGSEGV Will Deacon
2018-06-21 14:44 ` Mathieu Desnoyers
2018-06-21 14:57   ` Will Deacon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180621145715.GF22505@arm.com \
    --to=will.deacon@arm.com \
    --cc=boqun.feng@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox