Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jan 2001 20:13:52 GMT
From:      nick@netability.ie
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/24392: bogons in kernel linker
Message-ID:  <200101162013.f0GKDqG04219@pancake.netability.ie>

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

>Number:         24392
>Category:       kern
>Synopsis:       panic() if kldload used to load module which is already compiled into kernel
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 16 12:20:02 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Nick Hilliard
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
Network Ability Ltd.
>Environment:

	ipfw statically compiled into kernel

>Description:

	FreeBSD will reliably panic if ipfw is compiled into the kernel, and
	if an attempt is then made to load it dynamically and then unload it
	using kldload/kldunload. Looking at the code, I'd say that there was
	nothing particularly special about ipfw, and that it was a more generic
	problem which affects all kernel modules which register sysctls.

	What appears to be happening is this:

	"kldload ipfw" attempts to register ipfw module.  This first
	registers all of the sysctls (kern/kern_linker.c:284 in
	linker_load_file()), and the on the next line attempts to initialise
	the module using linker_file_sysinit().  This function calls
	module_register() which then returns an error (EEXIST), but this
	error is ignored, and the registration of the module completes
	further on down the function (oopsie - this is bad!)

	"kldload ipfw" then unloads the kernel module and de-registers the
	sysctls which are in use by the statically compiled ipfw module, and 
	panic occurs (didn't get any time to look into what's going on
	here).
	

>How-To-Repeat:

	Create kernel with ipfw compiled in statically, then:
	# kldload ipfw
	# kldunload ipfw
	<bang!>

>Fix:

	Ran out of time for a fix. Looks relatively easy to put in a quick
	fix, but I'm not familiar enough with the code to feel confident
	about fixing it - it's very likely that some sublety has escaped me.


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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