Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 01 Apr 2013 03:45:19 -0600
From:      Chris Torek <torek@torek.net>
To:        freebsd-hackers@freebsd.org
Subject:   boot time crash in if_detach_internal()
Message-ID:  <201304010945.r319jJw7027369@elf.torek.net>

next in thread | raw e-mail | index | archive | help
I have been poking about with the bhyve virtualization code in
FreeBSD 10-current, and managed to crash FreeBSD during its
bootstrap process due to the fact that if_detach is called
from boot time configuration code, before the internal domain
system initialization has happened.

I added the following patch to work around the problem.  As
the large comment notes, it might not be quite correct but it
does allow the boot to proceed (of course the "dead" network
device is soon a problem anyway...).

The fix mirrors (more or less) the code in if_attach_internal().
Feel free to accept, ignore, or modify the patch. :-)

Chris

diff --git a/sys/net/if.c b/sys/net/if.c
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -845,6 +845,15 @@
 
 	if_purgeaddrs(ifp);
 
+	/*
+	 * torek: it's not entirely clear to me where and how this
+	 * should go, but if domain_init_status < 2 then there should
+	 * be no inet, inet6, etc items, and this is where the crash
+	 * happens during boot, so let's try this:
+	 */
+	if (domain_init_status < 2)
+		return;
+
 #ifdef INET
 	in_ifdetach(ifp);
 #endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304010945.r319jJw7027369>