Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Sep 2004 07:34:37 +0200 (CEST)
From:      Dan Lukes <dan@obluda.cz>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/71388: panic due mac_policy_list_conditional_busy called before mac_init
Message-ID:  <200409050534.i855Yb4e000638@kulesh.obluda.cz>
Resent-Message-ID: <200409050540.i855eKWs037759@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         71388
>Category:       kern
>Synopsis:       panic due mac_policy_list_conditional_busy called before mac_init
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 05 05:40:20 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Dan Lukes
>Release:        FreeBSD 5.3-BETA3 i386
>Organization:
Obludarium
>Environment:
System: FreeBSD 5.3-BETA3 #5: Sun Sep 5 05:30:03 CEST 2004 /usr/obj/usr/src/sys/Dan i386
cvsup of RELENG_5 on Sep  5 01:55 CEST
src/sys/kern/kern_mac.c,v 1.113 2004/07/15 08:26:05 phk

option MAC within kernel configuration file; 
no other MAC_* options nor modules
SMP, ACPI

a kernel loadable module with an external reference that can't be resolved
by linker

>Description:
	On the start of boot, when linker link the preloaded modules,
including the one with unresolvable external reference, the system paniced:

panic: mtx_lock() of spin mutex (null) @ /usr/src/sys/kern/kern_mac.c:239

>How-To-Repeat:
	Preload module that has unresolvable reference
(for example, if_fxp when miibus.ko unavaiable) on boot (kernel with MAC
compiled-in)

>Fix:

	I'm sorry, no exact fix hint. 

	The relevant part of source:
src/sys/kern/kern_mac.c:
233: int
234: mac_policy_list_conditional_busy(void)
235: {
236: #ifndef MAC_STATIC
237:         int ret;
238: 
239:         mtx_lock(&mac_policy_mtx);

	The mac_policy_mtx is NULL as mac_init has not been called yet.

	The mac_policy_list_conditional_busy is called from
mac_check_kld_unload via MAC_CHECK macro.

	Althought I have no back-trace, the caller of mac_check_kld_unload
seems to be link_elf_link_preload via linker_file_unload.

	I'm not sure about the best place to test that the MAC layer is not
initialized yet. May be mac_policy_list_conditional_busy should return error
when called with mac_policy_mtx==NULL 
>Release-Note:
>Audit-Trail:
>Unformatted:



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