Patches for fixing module load/unload panics

Nicolai Petri nicolai at catpipe.net
Sun May 4 02:05:09 PDT 2003


Hi all

As the codefreeze is due very soon now (tm) I send in theese patches and hopes 
theese get commited before. 

patch 1 (kern_linker.patch) :
	This fixes panics related to loading a module that's already compiled
	into the kernel. (patch 2 avoids some of the problems too)
	It works by traversing the loaded module list, and if it's already loaded
	it simply aborts the moduleregistering process and returns EEXISTS.

patch 2 (kern_sysctl.patch) :
	This patch is somewhat related to the same issue as patch 1. When 
	loading a	module that contains a sysctl already present in the kernel,
	the sysctl_register fails. When unloading the module again it calls
	sysctl_unregister() and that leads to instant panic because of missing
	validity checks in sysctl_unregister.

The above 2 patches fixes 70-80 % of the kld unload related crashes I've seen
so far, but I know there is many ghosts hidden in the current kld-framework
and I'm trying to tidy this up a bit. Being realistic this means that a lot of
patches like the above will go to the 5.x tree and hopefully a reworked
kld-framework for 6.x.

In my quest for fixing/redesigning the kld framework I'm currently working
on a document describing my thoughts on this matter.
The document and newest versions of my patches can be found on this
website : http://hobbes.bsd-dk.dk/~npp/

Cheers,
Nicolai Petri
catpipe Systems ApS


More information about the freebsd-current mailing list