From owner-freebsd-bugs@FreeBSD.ORG Sun Sep 5 05:40:22 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 959FF16A4CE for ; Sun, 5 Sep 2004 05:40:22 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 63BA343D58 for ; Sun, 5 Sep 2004 05:40:21 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i855eKjN037767 for ; Sun, 5 Sep 2004 05:40:20 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i855eKWs037759; Sun, 5 Sep 2004 05:40:20 GMT (envelope-from gnats) Resent-Date: Sun, 5 Sep 2004 05:40:20 GMT Resent-Message-Id: <200409050540.i855eKWs037759@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Dan Lukes Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2269B16A4CE for ; Sun, 5 Sep 2004 05:34:41 +0000 (GMT) Received: from kulesh.obluda.cz (kulesh.obluda.cz [193.179.22.243]) by mx1.FreeBSD.org (Postfix) with ESMTP id D5FCF43D2F for ; Sun, 5 Sep 2004 05:34:39 +0000 (GMT) (envelope-from dan@kulesh.obluda.cz) Received: from kulesh.obluda.cz (localhost.eunet.cz [127.0.0.1]) by kulesh.obluda.cz (8.13.1/8.13.1) with ESMTP id i855YbPA000639 for ; Sun, 5 Sep 2004 07:34:37 +0200 (CEST) (envelope-from dan@kulesh.obluda.cz) Received: (from root@localhost) by kulesh.obluda.cz (8.13.1/8.13.1/Submit) id i855Yb4e000638; Sun, 5 Sep 2004 07:34:37 +0200 (CEST) (envelope-from dan) Message-Id: <200409050534.i855Yb4e000638@kulesh.obluda.cz> Date: Sun, 5 Sep 2004 07:34:37 +0200 (CEST) From: Dan Lukes To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/71388: panic due mac_policy_list_conditional_busy called before mac_init X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Dan Lukes List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Sep 2004 05:40:22 -0000 >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: