> On Oct 27, 2021, at 4:01 PM, Jason Thorpe <thor...@me.com> wrote: > > >> On Oct 27, 2021, at 3:44 PM, Valery Ushakov <u...@stderr.spb.ru> wrote: >> >> On Wed, Oct 27, 2021 at 07:50:55 -0700, Jason Thorpe wrote: >> >> I was wondering if it might be easier to not put the onus onto the >> caller and instead have a function that returns the interrupted >> ucontext (or NULL, if the pc is not in a trampoline). >> >> ucontext_t *__unwind_sigtramp(return_pc, return_sp) > > That would certainly be a nicer API.
Thought about it a little more. To make this really work, we’d definitely have to version sigaction() so that it fully de-supported sigcontext handlers. Otherwise, it’s a toss-up whether you have a sigcontext or a ucontext on the stack. I do think a __sigtramp_unwind() would also be a good addition. But I also see some value in the basic check (which you need to have to __sigtramp_unwind() anyway…). -- thorpej