NetBSD Problem Report #10147

Received: (qmail 19946 invoked from network); 18 May 2000 13:35:34 -0000
Message-Id: <200005181333.XAA10912@argo.akimbo.com.au>
Date: Thu, 18 May 2000 23:33:40 +1000 (EST)
From: lukem@netbsd.org
Reply-To: lukem@netbsd.org
To: gnats-bugs@gnats.netbsd.org
Subject: softdeps on /var panics -current alpha
X-Send-Pr-Version: 3.95

>Number:         10147
>Category:       port-alpha
>Synopsis:       enabling softdeps on /var panics my alpha during boot
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    thorpej
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 18 13:36:00 +0000 2000
>Closed-Date:    Sat May 20 04:02:03 +0000 2000
>Last-Modified:  Sat May 20 04:02:03 +0000 2000
>Originator:     Luke Mewburn
>Release:        2000/05/17
>Organization:
	NetBSD
>Environment:
System: NetBSD  1.4Y NetBSD 1.4Y (LUKEM_ALPHA-$Revision$) #1: Wed May 17 13:13:55 EST 2000 lukem@karybdis.akimbo.com.au:/var/scratch/kern.alpha/LUKEM_ALPHA alpha

>Description:
	when i enabled softdeps on /var on my alpha, it panics during
	boot. it's not always the same point; sometimes it's during
	dev_mkdb, sometimes in portmap, or whatever.

fatal kernel trap:

    trap entry = 0x2 (memory management fault)
    a0         = 0x3
    a1         = 0x1
    a2         = 0x0
    pc         = 0xfffffc000048153c
    ra         = 0xfffffc00004814a8
    curproc    = 0xfffffc0008c38968
        pid = 335, comm = portmap

panic: trap
Stopped in portmap at   cpu_Debugger+0x4:       ret     zero,(ra)

db> trace
cpu_Debugger() at cpu_Debugger+0x4
panic() at panic+0xec
trap() at trap+0x6b4
XentMM() at XentMM+0x20
--- memory management fault (from ipl 0) ---
chkdq() at chkdq+0xdc
ffs_truncate() at ffs_truncate+0x1fc
ufs_inactive() at ufs_inactive+0xec
vput() at vput+0xe4
ufs_remove() at ufs_remove+0xb8
sys_unlink() at sys_unlink+0x1c8
syscall() at syscall+0x1d0
XentSys() at XentSys+0x50
--- syscall (10, netbsd.sys_unlink) ---
--- user mode ---

db> reboot
syncing disks... panic: lockmgr: locking against myself
Stopped in portmap at   cpu_Debugger+0x4:       ret     zero,(ra)

db> reboot
rebooting...


>How-To-Repeat:
	enable softdeps on /var.
	boot alpha.
	watch it panic.

>Fix:
	annoy frank? :-)
>Release-Note:
>Audit-Trail:

From: Jason R Thorpe <thorpej@zembu.com>
To: lukem@netbsd.org
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-alpha/10147: softdeps on /var panics -current alpha
Date: Thu, 18 May 2000 06:52:25 -0700

 On Thu, May 18, 2000 at 11:33:40PM +1000, lukem@netbsd.org wrote:

  > --- memory management fault (from ipl 0) ---
  > chkdq() at chkdq+0xdc

 ...is it always via the quota check routine?

  > ffs_truncate() at ffs_truncate+0x1fc
  > ufs_inactive() at ufs_inactive+0xec
  > vput() at vput+0xe4
  > ufs_remove() at ufs_remove+0xb8
  > sys_unlink() at sys_unlink+0x1c8
  > syscall() at syscall+0x1d0
  > XentSys() at XentSys+0x50
  > --- syscall (10, netbsd.sys_unlink) ---
  > --- user mode ---

 -- 
         -- Jason R. Thorpe <thorpej@zembu.com>

From: Luke Mewburn <lukem@cs.rmit.edu.au>
To: thorpej@zembu.com
Cc: lukem@netbsd.org, gnats-bugs@gnats.netbsd.org
Subject: Re: port-alpha/10147: softdeps on /var panics -current alpha 
Date: Fri, 19 May 2000 21:57:23 +1000

 Jason R Thorpe writes:
 > On Thu, May 18, 2000 at 11:33:40PM +1000, lukem@netbsd.org wrote:
 > 
 >  > --- memory management fault (from ipl 0) ---
 >  > chkdq() at chkdq+0xdc
 > 
 > ...is it always via the quota check routine?

 not as far as i recall.

From: Luke Mewburn <lukem@cs.rmit.edu.au>
To: gnats-bugs@netbsd.org
Cc: thorpej@zembu.com, lukem@netbsd.org
Subject: Re: port-alpha/10147: softdeps on /var panics -current alpha
Date: Sat, 20 May 2000 12:29:21 +1000

 I wrote:
 |  Jason R Thorpe writes:
 |  > On Thu, May 18, 2000 at 11:33:40PM +1000, lukem@netbsd.org wrote:
 |  >
 |  >  > --- memory management fault (from ipl 0) ---
 |  >  > chkdq() at chkdq+0xdc
 |  >
 |  > ...is it always via the quota check routine?
 | 
 |  not as far as i recall.

 I've had another crash. This time whilst working in /var/scratch
 (which I had left with softdeps enabled). The backtrace looks like:

 	db> trace
 	cpu_Debugger() at cpu_Debugger+0x4
 	panic() at panic+0xec
 	trap() at trap+0x6b4
 	XentMM() at XentMM+0x20
 	--- memory management fault (from ipl 6) ---
 	chkdq() at chkdq+0xdc
 	ffs_truncate() at ffs_truncate+0x1fc
 	handle_workitem_remove() at handle_workitem_remove+0x2d8
 	softdep_process_worklist() at softdep_process_worklist+0x2c4
 	sched_sync() at sched_sync+0x26c
 	esigcode() at esigcode
 	--- root of call graph ---
 	db>

 Now, if you mean `chkdq()' in your query about `always via the quota
 check routine?', then yes, I think it does.

 I'll compile a new kernel without quotas (and with the rolled-back mfs
 stuff) and see how that goes.

 Is there any more info or testing I can do to assist in resolving this
 issue?

From: Jason R Thorpe <thorpej@zembu.com>
To: Luke Mewburn <lukem@cs.rmit.edu.au>
Cc: port-alpha-maintainer@netbsd.org, gnats-admin@netbsd.org
Subject: Re: port-alpha/10147: softdeps on /var panics -current alpha
Date: Fri, 19 May 2000 20:05:13 -0700

 On Sat, May 20, 2000 at 02:30:02AM -0000, Luke Mewburn wrote:

  >  	db> trace
  >  	cpu_Debugger() at cpu_Debugger+0x4
  >  	panic() at panic+0xec
  >  	trap() at trap+0x6b4
  >  	XentMM() at XentMM+0x20
  >  	--- memory management fault (from ipl 6) ---
  >  	chkdq() at chkdq+0xdc
  >  	ffs_truncate() at ffs_truncate+0x1fc

 Yes, the bug is that ffs_truncate() is calling chkdq() with NOCRED,
 and chkdq() is deferencing it without checking for that, first.

 Patch below.

 -- 
         -- Jason R. Thorpe <thorpej@zembu.com>

 Index: ufs_quota.c
 ===================================================================
 RCS file: /cvsroot/syssrc/sys/ufs/ufs/ufs_quota.c,v
 retrieving revision 1.15
 diff -c -r1.15 ufs_quota.c
 *** ufs_quota.c	2000/03/30 12:41:14	1.15
 --- ufs_quota.c	2000/05/20 03:08:19
 ***************
 *** 133,139 ****
   		}
   		return (0);
   	}
 ! 	if ((flags & FORCE) == 0 && cred->cr_uid != 0) {
   		for (i = 0; i < MAXQUOTAS; i++) {
   			if ((dq = ip->i_dquot[i]) == NODQUOT)
   				continue;
 --- 133,140 ----
   		}
   		return (0);
   	}
 ! 	if ((flags & FORCE) == 0 &&
 ! 	    (cred != NOCRED && cred->cr_uid != 0)) {
   		for (i = 0; i < MAXQUOTAS; i++) {
   			if ((dq = ip->i_dquot[i]) == NODQUOT)
   				continue;

State-Changed-From-To: open->feedback 
State-Changed-By: thorpej 
State-Changed-When: Fri May 19 20:20:05 PDT 2000 
State-Changed-Why:  
Patch sent to submitter; awaiting feedback. 
Responsible-Changed-From-To: port-alpha-maintainer->thorpej 
Responsible-Changed-By: thorpej 
Responsible-Changed-When: Fri May 19 20:21:47 PDT 2000 
Responsible-Changed-Why:  
Really a generic kernel problem.  However, I have fixed 
the bug, and will handle wrapping this one up. 
State-Changed-From-To: feedback->closed 
State-Changed-By: thorpej 
State-Changed-When: Fri May 19 21:01:53 PDT 2000 
State-Changed-Why:  
Submitter reports problem fixed. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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.