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

Re: Question about EXPORT_SYMBOL




> It goes like this :
> 
> 	1. module overtakes system call that calls a routine that can cause the task to
> 	   to sleep (kmalloc(), another system call etc. etc.)
> 	2. The task sleeps
> 	3. The module is unloaded.

	But that may happen even for a normal module that do not replace a
syscall by a fn. And hence the recommendation that is found in almost 
every module writing resource that always use MOD_INC/DEC while
loading/unloading a module to prevent accidental unloading.


> 	4. Another module is loaded, or the memory is somehow used otherwise
> 	5. The task wakes up and returns to garbage code, causing the kernel to panic.
> 
> You can either add MOD_INC/DEC_USE_COUNTs to your system call code (although this will still
> leave a very tiny race window), or make the module not unloadable by using can_unload().

	So the method is not altogether broken, right!!
--
sourav

> 
> In my module I took the second option because I couldn't afford the cost of the atomic
> operations implicit in MOD_INC/DEC_USE_COUNT
> 
> john
> 
> -- 
> "Allocation is a fatal error."
> 	- me, cpd_util.c. Never document at 4AM
> 
> -
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/
> IRC Channel:   irc.openprojects.net / #kernelnewbies
> Web Page:      http://www.surriel.com/kernelnewbies.shtml
> 

-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.surriel.com/kernelnewbies.shtml