From owner-freebsd-current@FreeBSD.ORG Sun May 4 02:05:08 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C9F9D37B401 for ; Sun, 4 May 2003 02:05:08 -0700 (PDT) Received: from pfepa.post.tele.dk (pfepa.post.tele.dk [193.162.153.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id B604943F85 for ; Sun, 4 May 2003 02:05:07 -0700 (PDT) (envelope-from nicolai@catpipe.net) Received: from 80.164.84.237 (unknown [80.164.84.237]) by pfepa.post.tele.dk (Postfix) with ESMTP id 4B9F848001E for ; Sun, 4 May 2003 11:05:05 +0200 (CEST) From: Nicolai Petri Organization: catpipe Systems ApS To: current@freebsd.org Date: Sun, 4 May 2003 11:05:02 +0200 User-Agent: KMail/1.5.1 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_+eNt+AB8ePEKtiF" Message-Id: <200305041105.02424.nicolai@catpipe.net> X-Content-Filtered-By: Mailman/MimeDel 2.1.1 Subject: Patches for fixing module load/unload panics X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 May 2003 09:05:09 -0000 --Boundary-00=_+eNt+AB8ePEKtiF Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 --Boundary-00=_+eNt+AB8ePEKtiF--