NetBSD Problem Report #23581
Received: (qmail 26216 invoked by uid 605); 27 Nov 2003 10:40:33 -0000
Message-Id: <200311271040.hARAeT7d000910@shark1.cambridge.arm.com>
Date: Thu, 27 Nov 2003 10:40:29 GMT
From: Richard Earnshaw <rearnsha@arm.com>
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: rearnsha@arm.com
To: gnats-bugs@gnats.netbsd.org
Subject: Random kernel crashes on ARM
X-Send-Pr-Version: 3.95
>Number: 23581
>Category: port-arm
>Synopsis: Random kernel crashes on ARM
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: port-arm-maintainer
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 27 10:41:00 +0000 2003
>Closed-Date: Tue Apr 27 14:05:34 +0000 2004
>Last-Modified: Thu Apr 29 04:11:00 +0000 2004
>Originator: Richard Earnshaw
>Release: NetBSD 1.6ZF
>Organization:
ARM Ltd
--
>Environment:
System: NetBSD shark1.cambridge.arm.com 1.6ZF NetBSD 1.6ZF (SHARK1) #0: Thu Nov 20 15:01:59 GMT 2003 rearnsha@pc960.cambridge.arm.com:/work/rearnsha/netbsd/build/src/shark/sys/arch/shark/compile/SHARK1 shark
Architecture: arm
Machine: shark
>Description:
Recent ARM kernels are showing random instability. My suspicsion
is that something, somewhere, is trampling on data structures.
Examples include:
1)
Kernel alignment fault 3 (TF: f55cedf8, PC: f0108e68, FSR: 0x85d9003
FAR: 0x65756e69)
at netbsd:uvm_uarea_alloc ldr r2, [r4] ; r4=0x65756e69
from fork
sys_fork
syscall_plain
swi_handler
in process sh
2)
panic: assertion failure: umap->refcount != 0
from: ubc_fault
uvm_fault
data_abort_handler
uio_move
ffs_write
VOP_WRITE
vn_write
dofile_write
sys_write
syscall_plain
swi_handler
Process was "expect" the gcc testsuite driver program. Same panic
also seen from sh.
3)
Also seen while running expect:
parent: sync byte write: bad address in system call argument
gnumake[1]: [check-gcc] Error 255 (ignored)
I've seen this on both cats and a shark.
4)
And on my cats machine only (kernel of similar vintage to above):
xemacs sees mmap return EINVAL for a perfectly reasonable set of
arguments for mapping /dev/zero.
This final problem is repeatable.
>How-To-Repeat:
Just run some kernel-intensive applications (the gcc testsuite seems
to be a good example).
>Fix:
No idea.
>Release-Note:
>Audit-Trail:
From: Richard Earnshaw <rearnsha@arm.com>
To: gnats-bugs@gnats.netbsd.org, jdolecek@arm.com
Cc: Richard.Earnshaw@arm.com
Subject: Re: port-arm/23581: Random kernel crashes on ARM
Date: Sat, 20 Dec 2003 14:41:55 +0000
This is a multipart MIME message.
--==_Exmh_17422639880
Content-Type: text/plain; charset=us-ascii
I've managed to track down issue 4 to a problem with Jaromir's DEV_ZERO
change on ARM back in October. Unless /dev/zero is re-created with the
new minor number, the problems reported can occur. There are two places
that relate to this: mm.c and uvm_mmap.c; both are using only the new
minor number in a test for accessing /dev/zero.
The patch below fixes that one problem (I haven't been able to make any
progress on the others yet), but it means a small amount of leakage of md
code into the mi parts of the kernel. As such, I'm not particularly happy
with it. I wonder whether the ARM port could intercept the open command
for this device and remap the minor number at that point?
R.
--==_Exmh_17422639880
Content-Type: message/rfc822 ; name="2813"
Content-Description: 2813
Content-Disposition: attachment; filename="2813"
Index: dev/mm.c
RCS file: /cvsroot/src/sys/dev/mm.c,v
retrieving revision 1.5
diff -p -p -r1.5 mm.c
*** dev/mm.c 21 Sep 2003 19:16:55 -0000 1.5
--- dev/mm.c 20 Dec 2003 10:37:25 -0000
*************** __KERNEL_RCSID(0, "$NetBSD: mm.c,v 1.5 2
*** 44,49 ****
--- 44,51 ----
* Memory special file
*/
+ #include "opt_compat_netbsd.h"
+
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/buf.h>
*************** mmioctl(dev, cmd, data, flag, p)
*** 67,72 ****
--- 69,77 ----
case DEV_MEM:
case DEV_KMEM:
case DEV_NULL:
+ #if defined(COMPAT_16) && defined(__arm__)
+ case _DEV_ZERO_oARM:
+ #endif
case DEV_ZERO:
switch (cmd) {
case FIONBIO: /* We never block anyway */
Index: uvm/uvm_mmap.c
===================================================================
RCS file: /cvsroot/src/sys/uvm/uvm_mmap.c,v
retrieving revision 1.78
diff -p -p -r1.78 uvm_mmap.c
*** uvm/uvm_mmap.c 7 Oct 2003 00:17:09 -0000 1.78
--- uvm/uvm_mmap.c 20 Dec 2003 10:37:38 -0000
***************
*** 53,58 ****
--- 53,60 ----
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.78 2003/10/07 00:17:09 thorpej Exp $");
+ #include "opt_compat_netbsd.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/file.h>
*************** sys_mmap(l, v, retval)
*** 403,409 ****
return (EOVERFLOW); /* no offset wrapping */
/* special case: catch SunOS style /dev/zero */
! if (vp->v_type == VCHR && vp->v_rdev == zerodev) {
flags |= MAP_ANON;
goto is_anon;
}
--- 405,416 ----
return (EOVERFLOW); /* no offset wrapping */
/* special case: catch SunOS style /dev/zero */
! if (vp->v_type == VCHR &&
! (vp->v_rdev == zerodev
! #if defined(COMPAT_16) && defined(__arm__)
! || vp->v_rdev == makedev(0, _DEV_ZERO_oARM)
! #endif
! )) {
flags |= MAP_ANON;
goto is_anon;
}
--==_Exmh_17422639880--
From: Jaromir Dolecek <jdolecek@NetBSD.org>
To: Richard Earnshaw <rearnsha@arm.com>
Cc: gnats-bugs@NetBSD.org
Subject: Re: port-arm/23581: Random kernel crashes on ARM
Date: Sat, 20 Dec 2003 17:17:10 +0100 (CET)
Richard Earnshaw wrote:
> Oops... I bet you didn't know you worked for arm... :-)
Ah, OK. Didn't realize this is my fault.
> *************** mmioctl(dev, cmd, data, flag, p)
> *** 67,72 ****
> - --- 69,77 ----
> case DEV_MEM:
> case DEV_KMEM:
> case DEV_NULL:
> + #if defined(COMPAT_16) && defined(__arm__)
> + case _DEV_ZERO_oARM:
> + #endif
> case DEV_ZERO:
> switch (cmd) {
> case FIONBIO: /* We never block anyway */
I guess this should be changed to do same thing for whatever
minor - something along:
Index: mm.c
===================================================================
RCS file: /cvsroot/src/sys/dev/mm.c,v
retrieving revision 1.5
diff -u -p -r1.5 mm.c
--- mm.c 21 Sep 2003 19:16:55 -0000 1.5
+++ mm.c 20 Dec 2003 15:23:23 -0000
@@ -64,10 +64,7 @@ mmioctl(dev, cmd, data, flag, p)
struct proc *p;
{
switch (minor(dev)) {
- case DEV_MEM:
- case DEV_KMEM:
- case DEV_NULL:
- case DEV_ZERO:
+ default:
switch (cmd) {
case FIONBIO: /* We never block anyway */
return 0;
@@ -81,8 +78,6 @@ mmioctl(dev, cmd, data, flag, p)
return 0;
/*FALLTHROUGH*/
}
- /*FALLTHROUGH*/
- default:
return EOPNOTSUPP;
}
}
> Index: uvm/uvm_mmap.c
> ===================================================================
> RCS file: /cvsroot/src/sys/uvm/uvm_mmap.c,v
> retrieving revision 1.78
> diff -p -p -r1.78 uvm_mmap.c
> *** uvm/uvm_mmap.c 7 Oct 2003 00:17:09 -0000 1.78
> - --- uvm/uvm_mmap.c 20 Dec 2003 10:37:38 -0000
> ***************
> *** 53,58 ****
> - --- 53,60 ----
> #include <sys/cdefs.h>
> __KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.78 2003/10/07 00:17:09
> thorpej Exp
> $");
>
> + #include "opt_compat_netbsd.h"
> +
> #include <sys/param.h>
> #include <sys/systm.h>
> #include <sys/file.h>
> *************** sys_mmap(l, v, retval)
> *** 403,409 ****
> return (EOVERFLOW); /* no offset wrapping *
> /
>
> /* special case: catch SunOS style /dev/zero */
> ! if (vp->v_type == VCHR && vp->v_rdev == zerodev) {
> flags |= MAP_ANON;
> goto is_anon;
> }
> - --- 405,416 ----
> return (EOVERFLOW); /* no offset wrapping *
> /
>
> /* special case: catch SunOS style /dev/zero */
> ! if (vp->v_type == VCHR &&
> ! (vp->v_rdev == zerodev
> ! #if defined(COMPAT_16) && defined(__arm__)
> ! || vp->v_rdev == makedev(0, _DEV_ZERO_oARM)
> ! #endif
> ! )) {
> flags |= MAP_ANON;
> goto is_anon;
> }
Perhaps use at least some sort of macro, defined on top of uvm_map.c,
just to improve readability of the code segment?
Something along:
#if defined(COMPAT_16) && define(__arm__)
#define MD_ZERODEV(x) (x == makedev(0, _DEV_ZERO_oARM)
#else
#define MD_ZERODEV(x) (0)
#endif
...
/* special case: catch SunOS style /dev/zero */
! if (vp->v_type == VCHR &&
! (vp->v_rdev == zerodev || MD_ZERODEV(vp->v_rdev))) {
The macro might even be defined in, say, arm/include/param.h
Jaromir
--
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.NetBSD.cz/
-=- We should be mindful of the potential goal, but as the Buddhist -=-
-=- masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow. Do not let this distract you.'' -=-
From: Richard Earnshaw <rearnsha@arm.com>
To: Jaromir Dolecek <jdolecek@NetBSD.org>
Cc: Richard Earnshaw <rearnsha@arm.com>, gnats-bugs@NetBSD.org
Subject: Re: port-arm/23581: Random kernel crashes on ARM
Date: Fri, 02 Jan 2004 15:24:54 +0000
> I guess this should be changed to do same thing for whatever
> minor - something along:
>
> Index: mm.c
> ===================================================================
> RCS file: /cvsroot/src/sys/dev/mm.c,v
> retrieving revision 1.5
> diff -u -p -r1.5 mm.c
> --- mm.c 21 Sep 2003 19:16:55 -0000 1.5
> +++ mm.c 20 Dec 2003 15:23:23 -0000
> @@ -64,10 +64,7 @@ mmioctl(dev, cmd, data, flag, p)
> struct proc *p;
> {
> switch (minor(dev)) {
> - case DEV_MEM:
> - case DEV_KMEM:
> - case DEV_NULL:
> - case DEV_ZERO:
> + default:
> switch (cmd) {
> case FIONBIO: /* We never block anyway */
> return 0;
> @@ -81,8 +78,6 @@ mmioctl(dev, cmd, data, flag, p)
> return 0;
> /*FALLTHROUGH*/
> }
> - /*FALLTHROUGH*/
> - default:
> return EOPNOTSUPP;
> }
> }
>
If the only entry in the switch is the default entry, then why keep the
switch at all?
> Perhaps use at least some sort of macro, defined on top of uvm_map.c,
> just to improve readability of the code segment?
> Something along:
>
> #if defined(COMPAT_16) && define(__arm__)
> #define MD_ZERODEV(x) (x == makedev(0, _DEV_ZERO_oARM)
> #else
> #define MD_ZERODEV(x) (0)
> #endif
>
> ...
>
> /* special case: catch SunOS style /dev/zero */
> ! if (vp->v_type == VCHR &&
> ! (vp->v_rdev == zerodev || MD_ZERODEV(vp->v_rdev))) {
>
> The macro might even be defined in, say, arm/include/param.h
Did you commit this bit? It seemed to be the key problem when I was
testing...
R.
From: Jaromir Dolecek <jdolecek@netbsd.org>
To: Richard.Earnshaw@arm.com
Cc: gnats-bugs@netbsd.org
Subject: Re: port-arm/23581: Random kernel crashes on ARM
Date: Sun, 4 Jan 2004 13:19:29 +0100 (CET)
Richard Earnshaw wrote:
> If the only entry in the switch is the default entry, then why keep the
> switch at all?
I made it so only to make it a bit easier to eventually
add specialized entry and to make the diff smaller. Perhaps the
switch should really be just removed althogether.
> > The macro might even be defined in, say, arm/include/param.h
>
> Did you commit this bit? It seemed to be the key problem when I was
> testing...
Not yet. I'll do that ASAP.
Jaromir
--
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.NetBSD.cz/
-=- We should be mindful of the potential goal, but as the Buddhist -=-
-=- masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow. Do not let this distract you.'' -=-
Responsible-Changed-From-To: port-arm-maintainer->jdolecek
Responsible-Changed-By: jdolecek
Responsible-Changed-When: Sun Jan 4 12:22:16 UTC 2004
Responsible-Changed-Why:
This is actually caused by my changes. I'll fix this soon.
State-Changed-From-To: open->closed
State-Changed-By: jdolecek
State-Changed-When: Sat Feb 14 12:20:35 UTC 2004
State-Changed-Why:
Fix committed, according to our previous discussion. Thanks for report.
From: Jaromir Dolecek <jdolecek@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: pr/23581 CVS commit: src/sys
Date: Sat, 14 Feb 2004 12:20:14 +0000 (UTC)
Module Name: src
Committed By: jdolecek
Date: Sat Feb 14 12:20:14 UTC 2004
Modified Files:
src/sys/arch/arm/include: param.h
src/sys/uvm: uvm_mmap.c
Log Message:
add compat hook in check for zerodev; use this hook to recognize
the old ARM /dev/zero minor mapping #ifdef COMPAT_16
fixes second part of PR kern/23581 by Richard Earnshaw
To generate a diff of this commit:
cvs rdiff -r1.8 -r1.9 src/sys/arch/arm/include/param.h
cvs rdiff -r1.79 -r1.80 src/sys/uvm/uvm_mmap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: closed->open
State-Changed-By: rearnsha
State-Changed-When: Sun Feb 15 17:54:28 UTC 2004
State-Changed-Why:
Only point 4 has been fixed so far. The panic (point 2) still persists.
Responsible-Changed-From-To: jdolecek->port-arm-maintainer
Responsible-Changed-By: jdolecek
Responsible-Changed-When: Sun Feb 15 18:35:31 UTC 2004
Responsible-Changed-Why:
My part of problem is fixed, I cannot help with generic ARM issues.
From: Steve Woodford <scw@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: port-arm/23581: Random kernel crashes on ARM
Date: Tue, 27 Apr 2004 08:19:34 +0100
Ok, revision 1.11 of src/sys/arch/arm/include/arm32/frame.h should fix
item #2.
Pullup requested for the 2.0 branch.
Cheers, Steve
----- Commit message -----
Module Name: src
Committed By: scw
Date: Tue Apr 27 07:13:16 UTC 2004
Modified Files:
src/sys/arch/arm/include/arm32: frame.h
Log Message:
Always disable interrupts at the start of
DO_AST_AND_RESTORE_ALIGNMENT_FAULTS.
This addresses #2 of port-arm/23581 by Richard Earnshaw.
Many thanks to Richard for spotting the cause of this problem.
To generate a diff of this commit:
cvs rdiff -r1.10 -r1.11 src/sys/arch/arm/include/arm32/frame.h
State-Changed-From-To: open->closed
State-Changed-By: rearnsha
State-Changed-When: Tue Apr 27 14:04:07 UTC 2004
State-Changed-Why:
PR's that describe multiple bugs are a pain. The two main problems described
in this bug report are now fixed. If I can isolate the remaining problems
again I'll file new reports.
From: James Chacon <jmc@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: pr/23581 CVS commit: [netbsd-2-0] src/sys/arch/arm/include/arm32
Date: Thu, 29 Apr 2004 04:10:34 +0000 (UTC)
Module Name: src
Committed By: jmc
Date: Thu Apr 29 04:10:34 UTC 2004
Modified Files:
src/sys/arch/arm/include/arm32 [netbsd-2-0]: frame.h
Log Message:
Pullup rev 1.11 (requested by scw in ticket #209)
Always disable interrupts at the start of
DO_AST_AND_RESTORE_ALIGNMENT_FAULTS. PR#23581
To generate a diff of this commit:
cvs rdiff -r1.10 -r1.10.2.1 src/sys/arch/arm/include/arm32/frame.h
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.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.