still trying to clarify "permanent"ly loaded modules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  as a followup to my earlier post about writing a kernel newbies
column for linux.com, i'm hoping to use this mailing list to ask the
occasional question for someone to clarify when, quite simply, i don't
have the time since i have about eight things on the go right now and
it would be ever so convenient if others decided to dig into some of
the more arcane details that i'd add to a future piece.

  right now, i'm trying to clarify what you can and can't do with a
module that's been loaded and marked as "[permanent]".  as i read it
(can't remember where now), if you manually load a module that has no
registered module_exit() routine, that module will show under "lsmod"
as "[permanent]" and is no longer unloadable.  you can see that from
this snippet from kernel/module.c in the print_unload_info() routine:

       if (mod->init != NULL && mod->exit == NULL) {
                printed_something = 1;
                seq_printf(m, "[permanent],");
       }

  i did test that with a trivial module and, sure enough, that's how
lsmod displayed it, and trying to unload it normally with "rmmod" told
me it was busy (even though no one else was using it).  fair enough.
but is that the whole story?

  i did this under a running kernel that did *not* support forced
module unloading, so the obvious thing would be to configure, build
and reboot under that new kernel and test again with "rmmod -f" but,
as i said, i just have too much to do today so if someone else wanted
a puzzle to solve, by all means, test it and let us know what happens.
in short, when you load a module like that, is it now really and truly
unloadable until you reboot the system?

rday

p.s.  from that code in kernel/module.c, it looks like having an
init() routine but no exit() routine is the *only* thing that labels a
loaded module as permanent.  just an observation.

--

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

        Linux Consulting, Training and Annoying Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Linked In:                             http://www.linkedin.com/in/rpjday
Twitter:                                       http://twitter.com/rpjday
========================================================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux