boot time crash in if_detach_internal()

Gleb Smirnoff glebius at FreeBSD.org
Tue Apr 2 08:57:10 UTC 2013


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.


More information about the freebsd-hackers mailing list