tech-kern 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 Sat, 16 Oct 2021 at 09:12, John Marino (NetBSD) <netbsd%marino.st@localhost> wrote:
>
> Alright, so I think we have established that it's impossible to
> provide KERN_PROC_SIGTRAMP as it functions on FreeBSD and DragonFly.
> The purpose of that sysctl is to get the address range of the single
> signal trampoline.

Backing up a little.  So the problem is that there's an instruction
pointer, a stack pointer, and a random set of other registers, and
we're trying to figure out the caller and its registers (aka unwind).
The way to do that is to find the unwind information.

It sounds like, for NetBSD, and a signal frame that the information
can be found in libc?

> Would it be possible to have a slightly different version on NetBSD
> that accomplishes the same thing?
> For example, call it KERN_PROC_SIGTRAMPS.  The first time it's called
> with a null oldp argument to get the result size, and the second time
> it's called with a properly sized buffer that is returned filled with
> address ranges like an array, one range for each defined signal tramp.
>
> It would be up to the program to iterate through the ranges to
> determine if a stack pointer is within a signal tramp range.
> And the gcc unwinder could be designed to only have to call it those 2
> times since the result is static per process.
>
> John


Home | Main Index | Thread Index | Old Index