linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Florian Weimer <fw@deneb.enyo.de>
Cc: Peter Zijlstra <peterz@infradead.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	paulmck <paulmck@kernel.org>, Boqun Feng <boqun.feng@gmail.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Paul Turner <pjt@google.com>,
	linux-api <linux-api@vger.kernel.org>,
	Christian Brauner <christian.brauner@ubuntu.com>,
	carlos <carlos@redhat.com>
Subject: Re: [RFC PATCH] rseq: x86: implement abort-at-ip extension
Date: Wed, 12 Jan 2022 16:24:10 -0500 (EST)	[thread overview]
Message-ID: <22043919.26476.1642022650520.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <87h7a87jpm.fsf@mid.deneb.enyo.de>

----- On Jan 12, 2022, at 4:00 PM, Florian Weimer fw@deneb.enyo.de wrote:

> * Mathieu Desnoyers:
> 
>> ----- On Jan 12, 2022, at 11:00 AM, Florian Weimer fw@deneb.enyo.de wrote:
>>
>>> * Peter Zijlstra:
>>> 
>>>> On Wed, Jan 12, 2022 at 04:16:36PM +0100, Florian Weimer wrote:
>>>>
>>>>> You could perhaps push a signal frame onto the stack.  It's going to
>>>>> be expensive, but it's already in the context switch path, so maybe it
>>>>> does not matter.
>>>>
>>>> Please no! Signals are a trainwreck that need change (see the whole
>>>> AVX-512 / AMX saga), we shouldn't use more of that just cause.
>>> 
>>> If it's a signal, it should be modeled as such.  I think it's pretty
>>> close to a synchronous signal.
> 
> (an asynchronous signal)
> 
>> Florian, just to validate here: is your argument about AVX-512/AMX or about
>> rseq abort-at-ip ?
> 
> rseq abort-at-ip.  I wonder if it is possible to use regular stack
> unwinding (through the signal frame) to figure out where the abort
> happened, and use the existing cleanup handler functionality in GCC.
> (Although -fnon-call-exceptions is not quite up to this, but in theory
> we would have to fix this for POSIX asynchronous cancellation/Ada
> asynchronous transfer of control support anyway.)

OK, so if we take x86-64 as an example, the abort would do:

/* Skip redzone and sigframe */
regs->sp -= 128 + sizeof(struct rt_sigframe);

It's unclear to me what should be the size of rt_sigframe here. Should it
include floating point state as well ?

Then at regs->sp, we can store a signal frame. The interesting bits would
go into (struct rt_sigframe  __user *)->uc which is a struct sigcontext.
It would contain all register state at the point where the critical section
was aborted.

The only register state we really care about is sigcontext "rip", given that
the userspace abort handler can save all other relevant registers by itself.

Then should we populate the other struct rt_sigframe fields or just zero them ?
I wonder what the meaning of "pretcode" and "struct siginfo" would be in the
context of an rseq abort ?

Thanks,

Mathieu

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

      reply	other threads:[~2022-01-12 21:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07 17:03 [RFC PATCH] rseq: x86: implement abort-at-ip extension Mathieu Desnoyers
2022-01-07 19:31 ` Florian Weimer
2022-01-07 19:48   ` Mathieu Desnoyers
2022-01-07 21:27     ` Mathieu Desnoyers
2022-01-07 22:27       ` David Laight
2022-01-08  1:08         ` Mathieu Desnoyers
2022-01-08  1:33           ` Mathieu Desnoyers
2022-01-08  1:33           ` Mathieu Desnoyers
2022-01-12 15:16     ` Florian Weimer
2022-01-12 15:26       ` Mathieu Desnoyers
2022-01-12 15:38       ` Peter Zijlstra
2022-01-12 16:00         ` Florian Weimer
2022-01-12 16:38           ` Mathieu Desnoyers
2022-01-12 21:00             ` Florian Weimer
2022-01-12 21:24               ` Mathieu Desnoyers [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=22043919.26476.1642022650520.JavaMail.zimbra@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=boqun.feng@gmail.com \
    --cc=carlos@redhat.com \
    --cc=christian.brauner@ubuntu.com \
    --cc=fw@deneb.enyo.de \
    --cc=hpa@zytor.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).