i386/77710: Linux page fault sigcontext information is wrong
Peter S. Housel
housel at acm.org
Fri Feb 18 20:30:28 PST 2005
>Number: 77710
>Category: i386
>Synopsis: Linux page fault sigcontext information is wrong
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-i386
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sat Feb 19 04:30:27 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Peter S. Housel
>Release: 6.0-CURRENT
>Organization:
>Environment:
FreeBSD housel.dyndns.org 6.0-CURRENT FreeBSD 6.0-CURRENT #4: Thu Feb 10 19:49:38 PST 2005 housel at housel.dyndns.org:/usr/obj/usr/src/sys/HOUSEL i386
>Description:
(Originally posted to emulation@ and hackers@ in May 2004 with no response.)
I'm running some Linux code (a garbage collector) that needs to trap page faults. There are a couple of problems with the i386 code that builds linux signal context:
/* ... */
frame.sf_sc.sc_err = regs->tf_err;
frame.sf_sc.sc_trapno = bsd_to_linux_trapcode(code);
The first problem is that the sc_cr2 field of the linux sigcontext is not initialized with the faulting address (obtained at page fault time from the cr2 register). The second problem is that sc_err is being initialized incorrectly, because in trap_pfault the original tf_err field provided by the processor has already been overwritten:
/* kludge to pass faulting virtual address to sendsig */
frame->tf_err = eva;
The trap handler has worked this way since trap.c revision 1.25 (now past its tenth anniversary). Surely there is some better way to pass eva to sendsig so thtat the 3-bit err field is not lost. (It would be nice if said field were available in the FreeBSD sigcontext, too, but that would likely involve an ABI change.)
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-i386
mailing list