tech-kern archive

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

Request for implementation of KERN_PROC_SIGTRAMP sysctl

Is it possible for NetBSD to implement KERN_PROC_SIGTRAMP sysctl?

For several years, the GNAT Ada compiler has not been able to unwind a
stack containing a signal trampoline.  The unwinder I wrote for gcc
several years ago just stopped working on newer NetBSD release even
though the signal trampoline code itself did not change.  FreeBSD and
DragonFly BSD are immune to sigtramp location changes because they've
introduced the KERN_PROC_SIGTRAMP sysctl which provides the location
of the signal tramp of the process.  It would be awesome if the NetBSD
kernel provided the same functionality, at least on x86.


I've recently been a part of an effort to revive the GNAT portion of
current GCC releases.  We succeeded with GCC 10.3 (in pkgsrc WIP) and
GCC 11.2.0 in Ravenports (soon to support NetBSD), but the testsuite
indicates it can no longer unwind properly.  The previous technique
(shown below) no longer works - I suspect the signal trampoline
location changed to inaccessible memory somewhere along the line.
With a sysctl like KERN_PROC_SIGTRAMP, we should be able to bring GNAT
functionality back to the level of FreeBSD and DragonFly.  It could
also be used in debuggers like GDB and other compilers (Go? Rust?)

I believe this sysctl would be useful so I'm hopeful somebody can implement it.

FreeBSD added the functionality in November 2013.
The current location of the code is here:

DragonFly added the functionality in March 2017.
The current location of the code is here:

GCC unwind code that no longer works:

Example of unwind code with KERN_PROC_SIGTRAMP (GCC):

Example of unwind code with KERN_PROC_SIGTRAMP (GDB):

John Marino

Home | Main Index | Thread Index | Old Index