Skip to contentSkip to conversation

rmmod whilst reading/writing sysctl

DISCUSSION John Levon 2 participants 2 messages Oct 31, 2001

lore
Share & tools
lore

John Levon

author
#0 lore raw

Where is the prevention of module unload whilst a sysctl from a module is being read/written ?

sysctl syscall is protected by BKL, but I can't see similar code for the cat >/proc/sys/... case

If there is none, how do I support sysctl from a module safely ?

thanks
john

Signature · 4 lines
"I'm dismayed whenever libertarianism and programming are associated; in my
 mind, it is as nebulous as associating people who write books as communists or
 those who read newspapers as capitalists."
	- graydon
#1 lore raw
Quoted 4 lines · John Levon

Where is the prevention of module unload whilst a sysctl from a module is being read/written ?

sysctl syscall is protected by BKL, but I can't see similar code for the cat >/proc/sys/...

... and that protection is worth nothing, since we copy data to/from userland. Forget about BKL - it doesn't prevent races.

There is a shitload of rmmod (and plain "we remove the object" - it doesn't have to be a module) races in that area. Composite trees _suck_. sysctls, devfs, ddfs - whatever. If tree is served by several drivers - it's broken.

In case of sysctls I have an old patch that could be turned into something working, but that will take a lot of changes in code that exports sysctls, so that may be very painful.