NetBSD Problem Report #26410
Received: (qmail 2859 invoked by uid 605); 23 Jul 2004 04:04:40 -0000
Message-Id: <Pine.BSF.4.51.0407222331370.71755@vegeta.city-net.com>
Date: Thu, 22 Jul 2004 23:53:44 -0400 (EDT)
From: Matthew Orgass <darkstar@city-net.com>
Sender: gnats-bugs-owner@NetBSD.org
To: gnats-bugs@gnats.netbsd.org
Subject: fp.S not updated for siginfo
>Number: 26410
>Category: port-mips
>Synopsis: fp.S not updated for siginfo
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: port-mips-maintainer
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jul 23 04:05:00 +0000 2004
>Closed-Date: Thu Mar 30 14:26:43 +0000 2006
>Last-Modified: Sat Feb 26 15:45:14 +0000 2011
>Originator: darkstar@city-net.com
>Release: NetBSD 2.0_BETA
>Organization:
>Environment:
>Description:
The arch/mips/mips/fp.S file has not been updated for siginfo. I
believe this means it is possible for an unpriviledged user to induce a
kernel TLB miss on any MIPS CPU. Also, I think e_trapsignal should be
called by this code, not trapsignal directly.
>How-To-Repeat:
I triggered this cancelling a ftp transfer on a softfloat machine,
possibly assisted by a different problem I am investigating.
>Fix:
I think the right thing to do would be to pass the info to a C function
in trap.c that sets up the ksi and calls e_trapsignal.
>Release-Note:
>Audit-Trail:
From: Simon Burge <simonb@wasabisystems.com>
To: Matthew Orgass <darkstar@city-net.com>
Cc: gnats-bugs@gnats.netbsd.org, netbsd-bugs@netbsd.org, port-mips@netbsd.org
Subject: Re: port-mips/26410: fp.S not updated for siginfo
Date: Fri, 23 Jul 2004 14:13:09 +1000
Hi Matthew,
Is this easily reproducable? If so, can you see if the patches in
http://mail-index.netbsd.org/port-mips/2004/07/03/0002.html
from Matthias Drochner fixes your problem?
Simon.
--
Simon Burge <simonb@wasabisystems.com>
NetBSD Support and Service: http://www.wasabisystems.com/
From: Matthew Orgass <darkstar@city-net.com>
To: Simon Burge <simonb@wasabisystems.com>
Cc: gnats-bugs@gnats.netbsd.org, netbsd-bugs@NetBSD.org, port-mips@NetBSD.org
Subject: Re: port-mips/26410: fp.S not updated for siginfo
Date: Fri, 23 Jul 2004 14:25:12 -0400 (EDT)
Doh. I even saved that message, but forgot all about it when I
encountered the bug :(.
It is actually reproducible. I'll send another PR for that. Presumably
this is a SOFTFLOAT bug. I am doing:
ftp -o /dev/null ftp://192.168.0.51/stuff
then cancelling the transfer (^C twice).
It seems mips_fputrap.c is not built for SOFTFLOAT. Moving that code to
trap.c makes it work as expected.
Matthew Orgass
darkstar@city-net.com
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: port-mips@NetBSD.org
Cc: gnats-bugs@netbsd.org, tsutsui@ceres.dti.ne.jp
Subject: Re: port-mips/26410: fp.S not updated for siginfo
Date: Sat, 25 Mar 2006 01:25:58 +0900
In article <Pine.BSF.4.51.0407231351310.74810@vegeta.city-net.com>
darkstar@city-net.com wrote:
> On 2004-07-23 simonb@wasabisystems.com wrote:
>
> > Is this easily reproducable? If so, can you see if the patches in
> >
> > http://mail-index.netbsd.org/port-mips/2004/07/03/0002.html
> >
> > from Matthias Drochner fixes your problem?
>
> Doh. I even saved that message, but forgot all about it when I
> encountered the bug :(.
>
> It is actually reproducible. I'll send another PR for that. Presumably
> this is a SOFTFLOAT bug. I am doing:
> ftp -o /dev/null ftp://192.168.0.51/stuff
> then cancelling the transfer (^C twice).
>
> It seems mips_fputrap.c is not built for SOFTFLOAT. Moving that code to
> trap.c makes it work as expected.
Any progress on this PR?
Is it okay to commit the attached patch to close it?
---
Izumi Tsutsui
Index: arch/mips/conf/files.mips
===================================================================
RCS file: /cvsroot/src/sys/arch/mips/conf/files.mips,v
retrieving revision 1.53
diff -u -r1.53 files.mips
--- arch/mips/conf/files.mips 11 Dec 2005 12:18:09 -0000 1.53
+++ arch/mips/conf/files.mips 24 Mar 2006 16:24:40 -0000
@@ -55,7 +55,7 @@
file arch/mips/mips/in_cksum.c inet
file netns/ns_cksum.c ns
-file arch/mips/mips/mips_fputrap.c !softfloat & !nofpu
+file arch/mips/mips/mips_fputrap.c softfloat | !nofpu
file arch/mips/mips/mips_emul.c
file arch/mips/mips/fp.S softfloat | !nofpu
Index: arch/mips/mips/fp.S
===================================================================
RCS file: /cvsroot/src/sys/arch/mips/mips/fp.S,v
retrieving revision 1.30
diff -u -r1.30 fp.S
--- arch/mips/mips/fp.S 23 Mar 2006 16:16:46 -0000 1.30
+++ arch/mips/mips/fp.S 24 Mar 2006 16:24:41 -0000
@@ -4967,7 +4967,7 @@
move a2, a0 # code = instruction
lw a0, _C_LABEL(curlwp) # get current process
li a1, SIGILL
- j _C_LABEL(trapsignal)
+ j _C_LABEL(fpemul_trapsignal)
END(fpemul_sigill)
STATIC_LEAF(fpemul_sigfpe)
@@ -4981,7 +4981,7 @@
move a2, a0 # code = instruction
lw a0, _C_LABEL(curlwp) # get current process
li a1, SIGFPE
- j _C_LABEL(trapsignal)
+ j _C_LABEL(fpemul_trapsignal)
END(fpemul_sigfpe)
#ifdef SOFTFLOAT
@@ -4996,6 +4996,6 @@
move a2, a0 # code = instruction
lw a0, _C_LABEL(curlwp) # get current process
li a1, SIGFPE
- j _C_LABEL(trapsignal)
+ j _C_LABEL(fpemul_trapsignal)
END(bcemul_sigfpe)
#endif
Index: arch/mips/mips/mips_fputrap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/mips/mips/mips_fputrap.c,v
retrieving revision 1.2
diff -u -r1.2 mips_fputrap.c
--- arch/mips/mips/mips_fputrap.c 11 Dec 2005 12:18:09 -0000 1.2
+++ arch/mips/mips/mips_fputrap.c 24 Mar 2006 16:24:41 -0000
@@ -33,6 +33,7 @@
#include <sys/siginfo.h>
#include <mips/cpuregs.h>
+#ifndef SOFTFLOAT
void mips_fpuexcept(struct lwp *, unsigned int);
void mips_fpuillinst(struct lwp *, unsigned int, unsigned long);
static int fpustat2sicode(unsigned int);
@@ -84,3 +85,20 @@
return (fpecodes[i].code);
return (FPE_FLTINV);
}
+#endif /* !SOFTFLOAT */
+
+void fpemul_trapsignal(struct lwp *, unsigned int, unsigned int);
+
+void
+fpemul_trapsignal(struct lwp *l, unsigned int sig, unsigned int code)
+{
+ ksiginfo_t ksi;
+
+ printf("emul_trapsignal(%x,%x)\n", sig, code);
+
+ KSI_INIT_TRAP(&ksi);
+ ksi.ksi_signo = sig;
+ ksi.ksi_code = 1; /* XXX */
+ ksi.ksi_trap = code;
+ (*l->l_proc->p_emul->e_trapsignal)(l, &ksi);
+}
From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@netbsd.org, port-mips-maintainer@netbsd.org,
gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
Matthew Orgass <darkstar@city-net.com>
Cc:
Subject: Re: port-mips/26410: fp.S not updated for siginfo
Date: Fri, 24 Mar 2006 12:06:16 -0500
On Mar 24, 4:30pm, tsutsui@ceres.dti.ne.jp (Izumi Tsutsui) wrote:
-- Subject: Re: port-mips/26410: fp.S not updated for siginfo
Looks fine to me.
christos
| The following reply was made to PR port-mips/26410; it has been noted by GNATS.
|
| From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
| To: port-mips@NetBSD.org
| Cc: gnats-bugs@netbsd.org, tsutsui@ceres.dti.ne.jp
| Subject: Re: port-mips/26410: fp.S not updated for siginfo
| Date: Sat, 25 Mar 2006 01:25:58 +0900
|
| In article <Pine.BSF.4.51.0407231351310.74810@vegeta.city-net.com>
| darkstar@city-net.com wrote:
|
| > On 2004-07-23 simonb@wasabisystems.com wrote:
| >
| > > Is this easily reproducable? If so, can you see if the patches in
| > >
| > > http://mail-index.netbsd.org/port-mips/2004/07/03/0002.html
| > >
| > > from Matthias Drochner fixes your problem?
| >
| > Doh. I even saved that message, but forgot all about it when I
| > encountered the bug :(.
| >
| > It is actually reproducible. I'll send another PR for that. Presumably
| > this is a SOFTFLOAT bug. I am doing:
| > ftp -o /dev/null ftp://192.168.0.51/stuff
| > then cancelling the transfer (^C twice).
| >
| > It seems mips_fputrap.c is not built for SOFTFLOAT. Moving that code to
| > trap.c makes it work as expected.
|
| Any progress on this PR?
| Is it okay to commit the attached patch to close it?
| ---
| Izumi Tsutsui
|
|
| Index: arch/mips/conf/files.mips
| ===================================================================
| RCS file: /cvsroot/src/sys/arch/mips/conf/files.mips,v
| retrieving revision 1.53
| diff -u -r1.53 files.mips
| --- arch/mips/conf/files.mips 11 Dec 2005 12:18:09 -0000 1.53
| +++ arch/mips/conf/files.mips 24 Mar 2006 16:24:40 -0000
| @@ -55,7 +55,7 @@
| file arch/mips/mips/in_cksum.c inet
| file netns/ns_cksum.c ns
|
| -file arch/mips/mips/mips_fputrap.c !softfloat & !nofpu
| +file arch/mips/mips/mips_fputrap.c softfloat | !nofpu
| file arch/mips/mips/mips_emul.c
| file arch/mips/mips/fp.S softfloat | !nofpu
|
| Index: arch/mips/mips/fp.S
| ===================================================================
| RCS file: /cvsroot/src/sys/arch/mips/mips/fp.S,v
| retrieving revision 1.30
| diff -u -r1.30 fp.S
| --- arch/mips/mips/fp.S 23 Mar 2006 16:16:46 -0000 1.30
| +++ arch/mips/mips/fp.S 24 Mar 2006 16:24:41 -0000
| @@ -4967,7 +4967,7 @@
| move a2, a0 # code = instruction
| lw a0, _C_LABEL(curlwp) # get current process
| li a1, SIGILL
| - j _C_LABEL(trapsignal)
| + j _C_LABEL(fpemul_trapsignal)
| END(fpemul_sigill)
|
| STATIC_LEAF(fpemul_sigfpe)
| @@ -4981,7 +4981,7 @@
| move a2, a0 # code = instruction
| lw a0, _C_LABEL(curlwp) # get current process
| li a1, SIGFPE
| - j _C_LABEL(trapsignal)
| + j _C_LABEL(fpemul_trapsignal)
| END(fpemul_sigfpe)
|
| #ifdef SOFTFLOAT
| @@ -4996,6 +4996,6 @@
| move a2, a0 # code = instruction
| lw a0, _C_LABEL(curlwp) # get current process
| li a1, SIGFPE
| - j _C_LABEL(trapsignal)
| + j _C_LABEL(fpemul_trapsignal)
| END(bcemul_sigfpe)
| #endif
| Index: arch/mips/mips/mips_fputrap.c
| ===================================================================
| RCS file: /cvsroot/src/sys/arch/mips/mips/mips_fputrap.c,v
| retrieving revision 1.2
| diff -u -r1.2 mips_fputrap.c
| --- arch/mips/mips/mips_fputrap.c 11 Dec 2005 12:18:09 -0000 1.2
| +++ arch/mips/mips/mips_fputrap.c 24 Mar 2006 16:24:41 -0000
| @@ -33,6 +33,7 @@
| #include <sys/siginfo.h>
| #include <mips/cpuregs.h>
|
| +#ifndef SOFTFLOAT
| void mips_fpuexcept(struct lwp *, unsigned int);
| void mips_fpuillinst(struct lwp *, unsigned int, unsigned long);
| static int fpustat2sicode(unsigned int);
| @@ -84,3 +85,20 @@
| return (fpecodes[i].code);
| return (FPE_FLTINV);
| }
| +#endif /* !SOFTFLOAT */
| +
| +void fpemul_trapsignal(struct lwp *, unsigned int, unsigned int);
| +
| +void
| +fpemul_trapsignal(struct lwp *l, unsigned int sig, unsigned int code)
| +{
| + ksiginfo_t ksi;
| +
| + printf("emul_trapsignal(%x,%x)\n", sig, code);
| +
| + KSI_INIT_TRAP(&ksi);
| + ksi.ksi_signo = sig;
| + ksi.ksi_code = 1; /* XXX */
| + ksi.ksi_trap = code;
| + (*l->l_proc->p_emul->e_trapsignal)(l, &ksi);
| +}
|
-- End of excerpt from Izumi Tsutsui
From: Izumi Tsutsui <tsutsui@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: PR/26410 CVS commit: src/sys/arch/mips
Date: Sat, 25 Mar 2006 00:08:11 +0000 (UTC)
Module Name: src
Committed By: tsutsui
Date: Sat Mar 25 00:08:11 UTC 2006
Modified Files:
src/sys/arch/mips/conf: files.mips
src/sys/arch/mips/mips: fp.S mips_fputrap.c
Log Message:
Update FPE trapsignal functions for new siginfo,
based on a patch provided by Matthias Drochner.
Ok'ed by christos, and fixes PR port-mips/26410.
To generate a diff of this commit:
cvs rdiff -r1.53 -r1.54 src/sys/arch/mips/conf/files.mips
cvs rdiff -r1.30 -r1.31 src/sys/arch/mips/mips/fp.S
cvs rdiff -r1.2 -r1.3 src/sys/arch/mips/mips/mips_fputrap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->feedback
State-Changed-By: tsutsui@netbsd.org
State-Changed-When: Sat, 25 Mar 2006 00:11:13 +0000
State-Changed-Why:
Fix committed. Could you confirm it?
State-Changed-From-To: feedback->closed
State-Changed-By: tsutsui@netbsd.org
State-Changed-When: Thu, 30 Mar 2006 14:26:43 +0000
State-Changed-Why:
Confirmed by submitter.
From: Matthias Scheler <tron@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: PR/26410 CVS commit: [netbsd-3] src/sys/arch/mips
Date: Wed, 19 Apr 2006 15:49:13 +0000 (UTC)
Module Name: src
Committed By: tron
Date: Wed Apr 19 15:49:13 UTC 2006
Modified Files:
src/sys/arch/mips/conf [netbsd-3]: files.mips
src/sys/arch/mips/mips [netbsd-3]: fp.S mips_fputrap.c
Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1260):
sys/arch/mips/mips/fp.S: revision 1.31
sys/arch/mips/mips/mips_fputrap.c: revision 1.3
sys/arch/mips/conf/files.mips: revision 1.54
Update FPE trapsignal functions for new siginfo,
based on a patch provided by Matthias Drochner.
Ok'ed by christos, and fixes PR port-mips/26410.
To generate a diff of this commit:
cvs rdiff -r1.51 -r1.51.6.1 src/sys/arch/mips/conf/files.mips
cvs rdiff -r1.28.14.1 -r1.28.14.2 src/sys/arch/mips/mips/fp.S
cvs rdiff -r1.1 -r1.1.16.1 src/sys/arch/mips/mips/mips_fputrap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Matthias Scheler <tron@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: PR/26410 CVS commit: [netbsd-3-0] src/sys/arch/mips
Date: Wed, 19 Apr 2006 15:49:28 +0000 (UTC)
Module Name: src
Committed By: tron
Date: Wed Apr 19 15:49:28 UTC 2006
Modified Files:
src/sys/arch/mips/conf [netbsd-3-0]: files.mips
src/sys/arch/mips/mips [netbsd-3-0]: fp.S mips_fputrap.c
Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1260):
sys/arch/mips/mips/fp.S: revision 1.31
sys/arch/mips/mips/mips_fputrap.c: revision 1.3
sys/arch/mips/conf/files.mips: revision 1.54
Update FPE trapsignal functions for new siginfo,
based on a patch provided by Matthias Drochner.
Ok'ed by christos, and fixes PR port-mips/26410.
To generate a diff of this commit:
cvs rdiff -r1.51 -r1.51.14.1 src/sys/arch/mips/conf/files.mips
cvs rdiff -r1.28.26.1 -r1.28.26.2 src/sys/arch/mips/mips/fp.S
cvs rdiff -r1.1 -r1.1.28.1 src/sys/arch/mips/mips/mips_fputrap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Izumi Tsutsui" <tsutsui@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/26410 CVS commit: src/sys/arch/mips/mips
Date: Sat, 26 Feb 2011 15:41:33 +0000
Module Name: src
Committed By: tsutsui
Date: Sat Feb 26 15:41:32 UTC 2011
Modified Files:
src/sys/arch/mips/mips: fp.S mips_fputrap.c
Log Message:
Use mips_fpexcept() instead of fpemul_trapsignal() to deliver SIGFPE,
and remove now unused fpemul_trapsignal() introduced for PR port-mips/26410.
Fixes PR port-mips/35326 and now t_except unmasked tests in
/usr/tests/lib/libc/ieeefp pass.
Note t_subnormal double test still fails as mentioned in PR port-mips/44639.
To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/mips/mips/fp.S
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mips/mips/mips_fputrap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.