Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Jul 2006 18:34:11 +0200
From:      Tijl Coosemans <tijl@ulyssis.org>
To:        kmacy@fsmware.com
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: i386 page fault clobbers error code in trap frame
Message-ID:  <200607301834.16657.tijl@ulyssis.org>
In-Reply-To: <b1fa29170607291257h43592826j75513b465074f115@mail.gmail.com>
References:  <200607292110.37733.tijl@ulyssis.org> <b1fa29170607291257h43592826j75513b465074f115@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
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 @@
                return (-1);
        }

-       /* kludge to pass faulting virtual address to sendsig */
-       frame->tf_err = eva;
-
        return((rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV);
 }

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (FreeBSD)

iD8DBQBEzN+IdMR2xnarec8RAsHKAKDHdOFNszIR4mgbUfzx2kthR3N9eACgrKmR
4deLo0S9sYFtD4DegfegMFA=
=x1wM
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607301834.16657.tijl>