Skip to contentSkip to conversation

module load/unload race protection?

DISCUSSION Mikael Pettersson 2 participants 2 messages Apr 14, 2001 – Apr 17, 2001

lore
Share & tools
lore
#0 lore raw

Does the kernel's module loader (kernel/module.c, not kmod) protect adequately against concurrent load/load or load/unload requests? The question applies to both 2.2 and 2.4 kernels.

I'm trying to track down a problem where a user using a RedHat 2.2.17-14 SMP kernel managed to trigger a situation where a driver module had been unloaded while still being in use (as in "the kernel has pointers into it", not USE_COUNT != 0). I'm reviewing the driver's internal INC/DEC_USE_COUNT usage, but so far I've not found any obvious errors.

/Mikael

#1 lore raw
Quoted 4 lines · Mikael Pettersson

Does the kernel's module loader (kernel/module.c, not kmod) protect adequately against concurrent load/load or load/unload requests? The question applies to both 2.2 and 2.4 kernels.

Quoted 8 lines

I'm trying to track down a problem where a user using a RedHat 2.2.17-14 SMP kernel managed to trigger a situation where a driver module had been unloaded while still being in use (as in "the kernel has pointers into it", not USE_COUNT != 0). I'm reviewing the driver's internal INC/DEC_USE_COUNT usage, but so far I've not found any obvious errors.

/Mikael

There are race conditions while module unloading, present in both 2.2 and 2.4 kernels. Efforts are being made in handling these races by using read-copy-update mechanism (http://lse.sourceforge.net/locking/rclock.html)
and by using synchronize_kernel() (from Rusty Russell, Keith Owens).

Regards,
Maneesh

Signature · 4 lines
Maneesh Soni <[email protected]>
http://lse.sourceforge.net/locking/rclock.html
IBM Linux Technology Center,
IBM Software Lab, Bangalore, India