Patch to Find the Address of a segv

William R. Dieter (dieter@dcs.uky.edu)
Thu, 31 Jul 1997 11:16:30 -0400


I have written a patch relative to 2.1.47 that allows programs to
determine the faulting address of a segmentation fault. Basically, it
patches handle_signal to pass some additional information to the user
signal handler in the siginfo structure. The patch will only work on
x86 machines because that is all I have to work (on Linux) with. The
siginfo structure is not filled out for signals other than SIGSEGV.

The interface is modeled after how Solaris 2 works. I suspect it is
probably POSIX, but I am having trouble finding POSIX documentation
locally. I think the si_addr field in the siginfo structure should be
part of a union, but I'm not exactly sure what else needs to be there.

You can get the patch through

http://www.dcs.uky.edu/~dieter/linux/segv-info-patch.html

There is also a simple program there showing how to get the faulting
address in the signal handler.

Bill.
dieter@dcs.uky.edu