NetBSD Problem Report #46606

From ryo_on@yk.rim.or.jp  Sat Jun 16 12:01:47 2012
Return-Path: <ryo_on@yk.rim.or.jp>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 368C263B9FE
	for <gnats-bugs@gnats.netbsd.org>; Sat, 16 Jun 2012 12:01:47 +0000 (UTC)
Message-Id: <20120616120147.368C263B9FE@www.NetBSD.org>
Date: Sat, 16 Jun 2012 12:01:47 +0000 (UTC)
From: ryoon@NetBSD.org
Reply-To: ryoon@NetBSD.org
To: gnats-bugs@gnats.NetBSD.org
Subject: NetBSD/i386 6.99.7 of today crashes during shutdown
X-Send-Pr-Version: 3.95

>Number:         46606
>Category:       kern
>Synopsis:       NetBSD/i386 6.99.7 of today crashes during shutdown
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 16 12:05:00 +0000 2012
>Closed-Date:    Sun Jan 05 10:40:19 +0000 2014
>Last-Modified:  Sun Jan 05 10:40:19 +0000 2014
>Originator:     Ryo ONODERA
>Release:        NetBSD 6.99.7
>Organization:

>Environment:


System: NetBSD hydrogen.elements.tetera.org 6.99.7 NetBSD 6.99.7 (LEAFGIRLD) #0: Sat Jun 16 20:47:57 JST 2012 root@hydrogen.elements.tetera.org:/usr/obj/sys/arch/i386/compile/LEAFGIRLD i386
Architecture: i386
Machine: i386
>Description:
During shutdown, today's NetBSD/i386 6.99.7 panics.
This problem occurs every shutdown.

% crash -N netbsd.7 -M netbsd.7.core
Crash version 6.99.4, image version 6.99.7.
WARNING: versions differ, you may not be able to examine this image.
System panicked: kernel diagnostic assertion "lwpcnt >= 0" failed: file "/usr/src/sys/kern/kern_uidinfo.c", line 217
Backtrace from time of crash is available.
crash> tr
_KERNEL_OPT_NAPMBIOS(c0b9a1a4,104,c05dce08,8,5,0,0,db6fe938,c01004d4,c28e5008) a
t 0
_end(104,0,fff6,c0c43733,c07d9245,8,c2392e40,db6d3000,0,1) at db6fe998
vpanic(c0b9a1a4,db6fe998,78aedf37,c2a27020,c28e5008,0,db6fe9cc,c058e047,c0b9a1a4
,c0b9a370) at vpanic+0x1cf
kern_assert(c0b9a1a4,c0b9a370,c0bf33ae,c0bf3460,d9,0,0,c05658e5,c2ca6540,0) at k
ern_assert+0x23
chglwpcnt(0,ffffffff,db6fe9ec,c28e502c,c2ca65ac,c2c5f480,db6fea3c,c0551868,c2c5f
480,0) at chglwpcnt+0x58
lwp_free(c2a27020,0,0,c0d031a0,c2086780,2,db6fea7c,c2a27020,c28e5008,db6feae0) a
t lwp_free+0x62
lwp_wait1(c2ca6540,0,db6feae0,1,c2a272c0,0,1,c07d7bc4,6,c25a86f0) at lwp_wait1+0
x7f
exit_lwps(c2ca6540,3,0,ffffffff,c28ec9f8,0,142,c289ee70,0,0) at exit_lwps+0xec
exit1(c2ca6540,f,0,20007606,db6fecf4,c2c80d40,db6fecac,c07f1aba,f,20007606) at e
xit1+0x59
sigexit(c2ca6540,f,f,0,0,0,0,fffffffd,0,c2ca66d0) at sigexit+0x132
postsig(f,1000,0,c2c5d1f0,db6feca0,c0cc215c,db6feca0,c2ca6540,106,db6fed48) at p
ostsig+0x145
lwp_userret(c2ca6540,db6fecf4,db6fed1c,c28ec9f4,c24df348,c0c6a580,c2ca6540,c28e5
008,0,bb83e918) at lwp_userret+0x1a1
syscall(db6fed48,bb7500b3,bb7500ab,bfbf001f,bb9c001f,5,5,bb83f934,8062178,2) at s
yscall+0x18a
crash>

>How-To-Repeat:
cvs update -dP
build.sh kernel=GENERIC
install kernel
reboot
reboot
panic

>Fix:

I have no idea.


>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/46606: NetBSD/i386 6.99.7 of today crashes during shutdown
Date: Sat, 16 Jun 2012 15:54:19 +0200

 On Sat, Jun 16, 2012 at 12:05:00PM +0000, ryoon@NetBSD.org wrote:
 > install kernel
 > reboot
 > reboot
 > panic

 This is not enough to reproduce it, I guess you need to run some
 (multithreaded) program after the first reboot.

 Can you find out which one it is that creates the problem for you?
 Running arbtirary threaded stuff does not do it for me either, so it
 must be something special you use.

 Martin

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, kern-bug-people@netbsd.org, 
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, ryoon@NetBSD.org
Cc: 
Subject: Re: kern/46606: NetBSD/i386 6.99.7 of today crashes during shutdown
Date: Sat, 16 Jun 2012 10:29:54 -0400

 On Jun 16,  1:55pm, martin@duskware.de (Martin Husemann) wrote:
 -- Subject: Re: kern/46606: NetBSD/i386 6.99.7 of today crashes during shutdo

 | The following reply was made to PR kern/46606; it has been noted by GNATS.
 | 
 | From: Martin Husemann <martin@duskware.de>
 | To: gnats-bugs@NetBSD.org
 | Cc: 
 | Subject: Re: kern/46606: NetBSD/i386 6.99.7 of today crashes during shutdown
 | Date: Sat, 16 Jun 2012 15:54:19 +0200
 | 
 |  On Sat, Jun 16, 2012 at 12:05:00PM +0000, ryoon@NetBSD.org wrote:
 |  > install kernel
 |  > reboot
 |  > reboot
 |  > panic
 |  
 |  This is not enough to reproduce it, I guess you need to run some
 |  (multithreaded) program after the first reboot.
 |  
 |  Can you find out which one it is that creates the problem for you?
 |  Running arbtirary threaded stuff does not do it for me either, so it
 |  must be something special you use.

 I left debugging in the previous revision of all the files that
 deal with chglwpcnt(), if you update to those revisions, recompile
 it will print which process makes the count negative.

 christos

From: Ryo ONODERA <ryo_on@yk.rim.or.jp>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/46606: NetBSD/i386 6.99.7 of today crashes during shutdown
Date: Sun, 17 Jun 2012 06:18:43 +0900 (JST)

 Hi,

 I have the following messages during boot.

 Jun 17 06:10:20 hydrogen savecore: reboot after panic: panic: kernel diagnostic assertion "lwpcnt >= 0" failed: file "/usr/src/sys/kern/kern_uidinfo.c", line 217 
 Jun 17 06:10:20 hydrogen savecore: system went down at Sun Jun 17 06:09:34 2012 
 Jun 17 06:10:20 hydrogen savecore: writing compressed core to /var/crash/netbsd.14.core.gz
 Jun 17 06:10:29 hydrogen savecore: writing compressed kernel to /var/crash/netbsd.14.gz

 And this problem occurs only when /etc/rc.conf has hal=YES.
 This enables hald from sysutils/hal.

 Thank you.

 -- 
 Ryo ONODERA // ryo_on@yk.rim.or.jp
 PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3


From: Ryo ONODERA <ryo_on@yk.rim.or.jp>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/46606: NetBSD/i386 6.99.7 of today crashes during shutdown
Date: Sun, 05 Jan 2014 19:32:16 +0900 (JST)

 Hi,

 The following commit solves my problem.
 No panic anymore.

 Thank you.


 Module Name:	src
 Committed By:	christos
 Date:		Mon Nov 25 16:29:25 UTC 2013

 Modified Files:
 	src/sys/kern: kern_lwp.c

 Log Message:
 Use the process credentials instead of the lwp credentials because if the
 process just did a setuid() call, the lwp might not have had a chance to
 refresh l->l_cred (still has LPR_CRMOD), and we don't want to bother spending
 time syncing the creds of a dying lwp. Should fix the problem with hald
 people have been observing.


 To generate a diff of this commit:
 cvs rdiff -u -r1.176 -r1.177 src/sys/kern/kern_lwp.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

 --
 Ryo ONODERA // ryo_on@yk.rim.or.jp
 PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3

State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Sun, 05 Jan 2014 10:40:19 +0000
State-Changed-Why:
Confirmed fixed, thank you!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

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