Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Feb 1996 01:43:27 -0500 (EST)
From:      Bill Paul <wpaul@skynet.ctr.columbia.edu>
To:        graichen@omega.physik.fu-berlin.de
Cc:        bugs@freebsd.org
Subject:   Re: kern/990: if_sl & if_ppp modules are not modunload'able if loaded
Message-ID:  <199602040643.BAA16917@skynet.ctr.columbia.edu>
In-Reply-To: <199602031140.MAA01198@prospero> from "Thomas Graichen" at Feb 3, 96 12:40:58 pm

next in thread | previous in thread | raw e-mail | index | archive | help
Of all the gin joints in all the world, Thomas Graichen had to walk
into mine and say:
 
> >Description:
> 
> if you have loaded one of the above modules (maybe there are more of them) you
> can't modunload 'em - modunload then says device busy - i think it's not
> really a bug - but it would be good if they would be unloadable (i.e. real
> loadable modules) - i think in linux you can unload also such if_xx modules

Well, whether this is a bug or not depends on your perspective. The
underlying problem is that once you attach a new network interface,
there's no easy way to 'unattach' it: to do it you would either have
to make the modules very smart or make what would undoubtedly be
substantial changes to the networking code, or both. Since nobody has
done any of these things yet, this means that modunloading the SLIP,
PPP or if_tun modules would panic the system. To understand why,
imagine what would happen if the page of memory containing the
interrupt handler for, say, your ethernet card suddenly turned into
all zeroes. The moment a packet arrives and the card signals an
interrupt, the kernel will try to jump into a section of nonexistent
code and explode.

To put it another way, modunloading a module causes the memory allocated
to the module to be unmapped. Before this happens, the module must
make sure that all references to it have been expunged from the
rest of the kernel, since any future attempt to reference the module
will obviously fail. And since the if_sl, if_ppp and if_tun modules
have no way to do that, they instead try to stop the user from shooting
himself in the foot by refusing to be unloaded.

So strictly speaking, the fact that you aren't allowed to unload these 
modules is not a bug, but a feature, since not letting them be unloaded
prevents the system from crashing. However, the fact that the system
will crash if you _do_ unload these modules is probably a bug, though
whoever sets out to fix it will have a lot of work ahead of him. :)

-Bill

-- 
=============================================================================
-Bill Paul            (212) 854-6020 | System Manager
Work:         wpaul@ctr.columbia.edu | Center for Telecommunications Research
Home:  wpaul@skynet.ctr.columbia.edu | Columbia University, New York City
=============================================================================
License error: The license for this .sig file has expired. You must obtain
a new license key before any more witty phrases will appear in this space.
=============================================================================



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