i386 page fault clobbers error code in trap frame
tijl at ulyssis.org
Sun Jul 30 16:34:35 UTC 2006
On Saturday 29 July 2006 21:57, Kip Macy wrote:
> Looking at siginfo it isn't clear that there is a "right way" to
> provide SIGSEGV, eva, and the error code.
> _fault._trapno should contain the machine's error code and si_signo
> should contain SIGSEGV, and si_addr contains the faulting pc. Maybe
> one could abuse si_code to contain eva. Sorry for asking a question
> that has already been answered but where is eva being put currently?
si_addr doesn't contain the faulting pc, it contains the address that
caused the page fault (i.e. eva). pc at the time of the fault is stored
in the sigcontext as sc_eip.
But siginfo is ok. The problem is in sigcontext (mostly a copy of
trapframe), where sc_err is incorrect. However, it appears that all the
relevant code has changed significantly in CURRENT to the point that
the offending line can simply be removed. It would be nice if somebody
could review/verify/test this, because I don't have CURRENT installed
at the moment.
--- sys/i386/i386/trap.c.orig Sun Jul 30 18:27:21 2006
+++ sys/i386/i386/trap.c Sun Jul 30 18:27:56 2006
@@ -777,9 +777,6 @@
- /* kludge to pass faulting virtual address to sendsig */
- frame->tf_err = eva;
return((rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20060730/f6ef7bac/attachment.pgp
More information about the freebsd-hackers