From owner-freebsd-current Mon Sep 10 7:29:14 2001 Delivered-To: freebsd-current@freebsd.org Received: from ringworld.nanolink.com (sentinel.office1.bg [217.75.135.254]) by hub.freebsd.org (Postfix) with SMTP id 64DC737B40A for ; Mon, 10 Sep 2001 07:29:03 -0700 (PDT) Received: (qmail 2007 invoked by uid 1000); 10 Sep 2001 14:28:29 -0000 Date: Mon, 10 Sep 2001 17:28:29 +0300 From: Peter Pentchev To: neckpain@nettaxi.com Cc: Andrzej Bialecki , cc@devcon.net, current@FreeBSD.ORG, audit@FreeBSD.org Subject: Re: problem with dynamic sysctls in -current Message-ID: <20010910172829.A1983@ringworld.oblivion.bg> Mail-Followup-To: neckpain@nettaxi.com, Andrzej Bialecki , cc@devcon.net, current@FreeBSD.ORG, audit@FreeBSD.org References: <200109090052.RAA03215@taxismtp2.alchemyfx.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200109090052.RAA03215@taxismtp2.alchemyfx.com>; from neckpain@nettaxi.com on Sun, Sep 09, 2001 at 09:49:59AM +0900 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, Sep 09, 2001 at 09:49:59AM +0900, neckpain@nettaxi.com wrote: > On Sat, Sep 08, 2001 at 10:27:10PM +0200, Christian Carstensen wrote: > > > > hmm, > > > > i've posted the attached mail a week ago to this list, but got no > > response. could someone please comment on this issue? > > I've also posted a patch(much less refined than yours, though) last month > but still got no response. Maybe you need to talk to the person who committed > rev 1.112 of kern_sysctl.c ? Ouch! I was wondering why no one complained about the way I broke dynamic module unloading.. Guess I don't read -current as much as I should.. Anyway - yes, I am aware of the breakage that rev 1.112 introduced, although I only became aware of it a week or so ago, when I tried to MFC it to 4.4-RC.. I wrote up a quick patch to make things work again, a short discussion on -arch followed, resulting in no real agreement except for "it's broken, somebody should fix it". This, of course, is definitely not an appropriate way to end a discussion about a FreeBSD kernel breakage, but I've been a bit held up by real work events lately, and my -current system went a-bye-bye due to unrelated issues, so I had no system to test any kind of fixes on. I am CC'ing this to Andrej Bialecki, who seems to know a bit more than me about kern_sysctl.c; Andrej, is the attached patch good enough to be committed as an interim fix, until somebody actually gets around to fixing the sysctl_ctx_free() algorithm? This patch is definitely way better than my hack, which added a bogus new argument to sysctl_add_oid() :) If there are no objections, I could commit this in the next few days and take on the responsibility to really look into this in a week or two, and really clean up the mess I made.. G'luck, Peter -- Nostalgia ain't what it used to be. > > ---------- Forwarded message ---------- > > Date: Sat, 1 Sep 2001 03:26:46 +0200 (CEST) > > From: Christian Carstensen > > To: current@freebsd.org > > Subject: dynamic sysctl problem and proposed hot fix > > > > > > hi, > > > > i just came across a problem with dynamic sysctls: > > when unloading a driver module that used dyn sysctls, my system paniced > > with "oid too high". that problem is caused by sysctl_ctx_free() in > > kern/kern_sysctl.c, that first deregisters all oids in the list to see if > > a error occurs. then, all oids are being reregistered and, if there was no > > error, they're finally removed. > > during the second phase, sysctl_register_oid(e1->entry) is called with > > n := e1->entry->oid_number being the old oid number with n > CTL_AUTO_START. > > that leads to panic("static sysctl too high") in sysctl_register_oid. > > one approach might be to initialize the oid_number field to contain the > > value OID_AUTO before calling sysctl_regiser_oid, but i'm unsure about the > > side effects of doing that in sysctl_ctx_free(). > > alternatively, the "old" oid number could be reused, the following patch > > should do, but it's just a workaround. > > > > > > best, > > christian > > > > -- > > "Sorry, no defects found. Please try a different search" > > [http://www.cisco.com/support/bugtools/bugtool.shtml] > > > > > > Index: kern_sysctl.c > > =================================================================== > > RCS file: /usr/cvs/src/sys/kern/kern_sysctl.c,v > > retrieving revision 1.113 > > diff -r1.113 kern_sysctl.c > > 83a84,96 > > > static struct sysctl_oid * > > > sysctl_find_oidnumber(const int number, struct sysctl_oid_list *list) > > > { > > > struct sysctl_oid *oidp; > > > > > > SLIST_FOREACH(oidp, list, oid_link) { > > > if (oidp->oid_number == number) { > > > return (oidp); > > > } > > > } > > > return (NULL); > > > } > > > > > 125c138,139 > > < panic("static sysctl oid too high: %d", oidp->oid_number); > > --- > > > if (sysctl_find_oidnumber(oidp->oid_number, parent)) > > > panic("static sysctl oid too high: %d", oidp->oid_number); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message