Re: [RFC PATCH] rseq: x86: implement abort-at-ip extension

From: Florian Weimer
Date: Wed Jan 12 2022 - 16:01:18 EST


* Mathieu Desnoyers:

> ----- On Jan 12, 2022, at 11:00 AM, Florian Weimer fw@xxxxxxxxxxxxx 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.)