kldunload Ratal trap 12: page fault

Matthew Dillon dillon at apollo.backplane.com
Mon Jan 5 12:24:58 PST 2004

    Ok, I found it.   Here is the dependancy:

    snd_sb16	depends on snd_pcm and snd_sbc
    snd_sbc	depends on snd_pcm

    The problem is that snd_sbc is not bumping the ref count on snd_pcm.
    If you attempt to kldload snd_sbc manually, with no other sound modules
    loaded, it will fail trying to find a symbol.  It will not load snd_pcm.

    When you try to load snd_sb16, it forces snd_sbc and snd_pcm to be loaded.
    But when you unload snd_sb16, since there is no information on the
    sbc->pcm dependancy, snd_sb16 will happily unload snd_pcm BEFORE 
    unload snd_sb16.

    The fix is to add the appropriate KMODDEPS to the Makefile for sbc
    (/usr/src/sys/dev/sound/driver/sbc/Makefile), which I just did.


    Ok, so what about the MODULE_DEPEND() lines in the module source code?
    We implement the proper linker sets to support MODULE_DPEND(), but we
    do not yet implement code to actually use them.  FreeBSD-5, but it's
    a terrible hack.

    What needs to be done in DragonFly is to (A) load the modules associated
    with MODULE_DEPEND() linker sets in the kld, (B) restrict the
    dynamic linking symbol lookups to just those symbols available from the
    kernel and specified MODULE_DEPEND() lines, and (C) remove the global
    symbol data and make it per-module like it should have been in the first

    FreeBSD-5 does (A) but does not do (B) or (C) (as far as I can tell).


More information about the Bugs mailing list