tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Request for implementation of KERN_PROC_SIGTRAMP sysctl



> On Oct 28, 2021, at 8:49 AM, Valery Ushakov <uwe%stderr.spb.ru@localhost> wrote:
> 
> It is ucontext for the siginfo trampoline and sigcontext for the older
> one, isn't it?

Ok, I’ve settled on the following:

void *__sigtramp_unwind_np(void *pc, void *sp, int *versp);

Given a program counter and stack pointer, return a pointer to the context that will be restored when the signal handler returns.  The signal trampoline version is returned in *versp; versp must not be NULL, and passing NULL will result in undefined behavior.

Returns NULL if the provided pc is not within the signal trampoline, or if the location of the context to restore cannot be determined.

If the returned version is within the range __SIGTRAMP_SIGINFO_VERSION_MIN … __SIGTRAMP_SIGINFO_VERSION_MAX, then the returned context points to a ucontext_t.

If the returned version is within the range __SIGTRAMP_SIGCONTEXT_VERSION_MIN … __SIGTRAMP_SIGCONTEXT_VERSION_MAX, then the returned context points to a struct sigcontext.

Note that the layout of the context structures is architecture-dependent and may also be version-dependent.

Does this sound good to everyone? 

-- thorpej



Home | Main Index | Thread Index | Old Index