From owner-freebsd-hackers@FreeBSD.ORG Tue Apr 2 08:57:10 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8426A6CC for ; Tue, 2 Apr 2013 08:57:10 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id 138B4F4 for ; Tue, 2 Apr 2013 08:57:09 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.6/8.14.6) with ESMTP id r328v8PO080397; Tue, 2 Apr 2013 12:57:08 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.6/8.14.6/Submit) id r328v816080396; Tue, 2 Apr 2013 12:57:08 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 2 Apr 2013 12:57:08 +0400 From: Gleb Smirnoff To: Chris Torek Subject: Re: boot time crash in if_detach_internal() Message-ID: <20130402085708.GI76816@FreeBSD.org> References: <201304010945.r319jJw7027369@elf.torek.net> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201304010945.r319jJw7027369@elf.torek.net> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Apr 2013 08:57:10 -0000 On Mon, Apr 01, 2013 at 03:45:19AM -0600, Chris Torek wrote: C> I have been poking about with the bhyve virtualization code in C> FreeBSD 10-current, and managed to crash FreeBSD during its C> bootstrap process due to the fact that if_detach is called C> from boot time configuration code, before the internal domain C> system initialization has happened. C> C> I added the following patch to work around the problem. As C> the large comment notes, it might not be quite correct but it C> does allow the boot to proceed (of course the "dead" network C> device is soon a problem anyway...). C> C> The fix mirrors (more or less) the code in if_attach_internal(). C> Feel free to accept, ignore, or modify the patch. :-) C> C> Chris C> C> diff --git a/sys/net/if.c b/sys/net/if.c C> --- a/sys/net/if.c C> +++ b/sys/net/if.c C> @@ -845,6 +845,15 @@ C> C> if_purgeaddrs(ifp); C> C> + /* C> + * torek: it's not entirely clear to me where and how this C> + * should go, but if domain_init_status < 2 then there should C> + * be no inet, inet6, etc items, and this is where the crash C> + * happens during boot, so let's try this: C> + */ C> + if (domain_init_status < 2) C> + return; C> + C> #ifdef INET C> in_ifdetach(ifp); C> #endif Can you provide a backtrace that leads to this? -- Totus tuus, Glebius.