NetBSD Problem Report #38599
From mlelstv@henery.1st.de Tue May 6 21:23:01 2008
Return-Path: <mlelstv@henery.1st.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by narn.NetBSD.org (Postfix) with ESMTP id 2C1DD63B293
for <gnats-bugs@gnats.NetBSD.org>; Tue, 6 May 2008 21:23:01 +0000 (UTC)
Message-Id: <20080506212113.11B2C28181@henery.1st.de>
Date: Tue, 6 May 2008 23:21:13 +0200 (CEST)
From: mlelstv@serpens.de
Reply-To: mlelstv@serpens.de
To: gnats-bugs@gnats.NetBSD.org
Subject: panic crashes in early bootstrap
X-Send-Pr-Version: 3.95
>Number: 38599
>Category: kern
>Synopsis: panic crashes in early bootstrap
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue May 06 21:25:00 +0000 2008
>Closed-Date: Mon Feb 15 09:54:49 +0000 2016
>Last-Modified: Mon Feb 15 09:54:49 +0000 2016
>Originator: Michael van Elst
>Release: NetBSD 4.0_STABLE
>Organization:
--
Michael van Elst
Internet: mlelstv@serpens.de
"A potential Snark may lurk in every tree."
>Environment:
System: ELF 64-bit MSB executable, SPARC V9, version 1 (SYSV), statically linked, for NetBSD 4.99.62, not stripped
Architecture: sparc64
Machine: sparc64
>Description:
When panic is called early in bootstrap it crashes on a GENERIC kernel.
The reason is that it accesses curlwp and curcpu() to be safe on
multiprocessors. Those data structures haven't been initialized and
on sparc64 not even mapped before pmap_bootstrap() has run.
A panic in pmap_bootstrap() or earlier will therefore crash instead
of emitting a useful panic message.
>How-To-Repeat:
Try to boot a sparc64 kernel on a T2000.
>Fix:
Make the curlwp accesses conditional on wether the data
structures have been initialized. The first thing main()
does is initializing lwp0.l_cpu (unless LWP0_CPU_INFO
is #defined), therefore a possible check would be:
if (lwp0.l_cpu && curlwp) {
/*
* Disable preemption. If already panicing on another CPU, sit
* here and spin until the system is rebooted. Allow the CPU th
at
* first paniced to panic again.
*/
kpreempt_disable();
ci = curcpu();
oci = atomic_cas_ptr((void *)&paniccpu, NULL, ci);
if (oci != NULL && oci != ci) {
/* Give interrupts a chance to try and prevent deadlock.
*/
spl0();
for (;;) {
DELAY(10);
}
}
/*
* Convert the current thread to a bound thread and prevent all
* CPUs from scheduling unbound jobs. Do so without taking any
* locks.
*/
curlwp->l_pflag |= LP_BOUND;
for (CPU_INFO_FOREACH(cii, ci)) {
ci->ci_schedstate.spc_flags |= SPCF_OFFLINE;
}
}
>Release-Note:
>Audit-Trail:
From: Michael van Elst <mlelstv@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/38599 CVS commit: src/sys/kern
Date: Tue, 10 Mar 2009 10:48:10 +0000
Module Name: src
Committed By: mlelstv
Date: Tue Mar 10 10:48:10 UTC 2009
Modified Files:
src/sys/kern: subr_prf.c
Log Message:
Make curlwp accesses conditional on wether the data structures
have been initialized. Fixes PR kern/38599.
To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/kern/subr_prf.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->closed
State-Changed-By: pooka@NetBSD.org
State-Changed-When: Tue, 29 Jun 2010 12:35:42 +0300
State-Changed-Why:
submitter committed a fix over a year ago
State-Changed-From-To: closed->analyzed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 29 Jun 2010 20:23:21 +0000
State-Changed-Why:
but, should be pulled up to -5
State-Changed-From-To: analyzed->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 15 Feb 2016 09:54:49 +0000
State-Changed-Why:
pullups to -5 are not in the cards these days
>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-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.