From nobody@FreeBSD.org  Sat Feb 19 04:22:46 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 4E0B116A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 19 Feb 2005 04:22:46 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 2915843D45
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 19 Feb 2005 04:22:46 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j1J4Mjec000702
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 19 Feb 2005 04:22:45 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j1J4MjNB000701;
	Sat, 19 Feb 2005 04:22:45 GMT
	(envelope-from nobody)
Message-Id: <200502190422.j1J4MjNB000701@www.freebsd.org>
Date: Sat, 19 Feb 2005 04:22:45 GMT
From: "Peter S. Housel" <housel@acm.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Linux page fault sigcontext information is wrong
X-Send-Pr-Version: www-2.3

>Number:         77710
>Category:       kern
>Synopsis:       [linux] Linux page fault sigcontext information is wrong
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-emulation
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 19 04:30:27 GMT 2005
>Closed-Date:    Fri Sep 21 04:22:15 GMT 2007
>Last-Modified:  Fri Sep 21 04:22:15 GMT 2007
>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@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:
Responsible-Changed-From-To: freebsd-i386->freebsd-emulation 
Responsible-Changed-By: vs 
Responsible-Changed-When: Thu Mar 17 11:28:54 GMT 2005 
Responsible-Changed-Why:  
Over to maintainers 

http://www.freebsd.org/cgi/query-pr.cgi?pr=77710 
Responsible-Changed-From-To: freebsd-emulation->emulation 
Responsible-Changed-By: gerald 
Responsible-Changed-When: Mon Mar 21 14:17:42 GMT 2005 
Responsible-Changed-Why:  
Use canonical name of the emulation@ list. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=77710 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/77710: commit references a PR
Date: Thu, 20 Sep 2007 21:25:19 +0000 (UTC)

 kib         2007-09-20 13:46:26 UTC
 
   FreeBSD src repository
 
   Modified files:
     sys/i386/linux       linux_sysvec.c 
     sys/amd64/linux32    linux32_sysvec.c 
   Log:
   Fill in cr2 in the signal context from ksi->ksi_addr.
   Together with the sys/i386/i386/trap.c rev. 1.306 it fixes the PR.
   
   Submitted by:   rdivacky
   Suggested by:   jhb
   Sponsored by:   Google Summer of Code 2007
   PR:             kern/77710
   Approved by:    re (kensmith)
   
   Revision  Changes    Path
   1.31      +2 -0      src/sys/amd64/linux32/linux32_sysvec.c
   1.150     +2 -0      src/sys/i386/linux/linux_sysvec.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: kib 
State-Changed-When: Fri Sep 21 04:21:41 UTC 2007 
State-Changed-Why:  
Fix committed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=77710 
>Unformatted:
