Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Aug 2001 16:21:35 +0900
From:      neckpain@nettaxi.com
To:        current@FreeBSD.ORG
Subject:   Re: panic kldunload'ing: static sysctl oid too high
Message-ID:  <200108190721.AAA11589@taxismtp1.alchemyfx.com>
In-Reply-To: <200108110622.XAA21343@taxismtp1.alchemyfx.com>
References:  <200108102252.PAA03031@taxismtp1.alchemyfx.com> <200108110622.XAA21343@taxismtp1.alchemyfx.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Aug 11, 2001 at 03:22:21PM +0900, I wrote:
> >  - unloading snd_ds1 always panics(either when it's loaded from
> >     /boot/loader.conf, or from the command line by kldload).
> >  - loading and unloading snd_pcm alone does not panic(snd_pcm is a driver
> >     loaded as dependency when snd_ds1 is loaded).
> >  - unloading some other modules does not panic.
> >  - the last kernel I remember that didn't panic was from 2001.07.20.00.00.00 .
> 
> And attached is a patch to kern_sysctl.c I'm using currently as a workaround.
> It just adds a test mode to internal sysctl_remove_oid() and avoid
> reregistering removed oid in sysctl_ctx_free().

Would someone please commit this or any better version? I think this is not
specific to snd_ds1, but a small bug in kern_sysctl.c .

0. A KLD driver allocates an oid with OID_AUTO specified. It's assigned
    oid_number >= 0x100.
1. When the driver is unloaded, sysctl_ctx_free() is called from detach
    routine in a KLD driver.
2. Inside sysctl_ctx_free(), sysctl_remove_oid() is issued for each context
    entry to make sure the entire list can really be freed. If failed,
    it tries to restore once removed entries back to the list by
    sysctl_register_oid().
3. sysctl_register_oid() rejects a dynamically allocated oid and panic.

The "FIXME" code worked without a pain before kern_sysctl.c, rev 1.112
because sysctl_register_oid() didn't check if oid_number is below the range
reserved for dynamic assignment of oid_number.

[patch in <200108110622.XAA21343@taxismtp1.alchemyfx.com> omitted]


By the way, I found recently that flood-pinging a PCCARD NIC(which shares
irq9 with snd_ds1 driver) seems to make my non-working dsp device play sound.
Really weird.

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




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