public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] race in request_module()
@ 2002-04-23  0:49 Alexander Viro
  2002-04-23  0:58 ` Matthew Dharm
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Alexander Viro @ 2002-04-23  0:49 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Keith Owens, linux-kernel

	Looks like request_module() has quite a few problems:

* there is no way to distinguish between failing modprobe and successful
  one followed by rmmod -a (e.g. called by cron).  For one thing, we
  don't pass exit value of modprobe to caller of request_module().

* even if we would pass it, obvious attempt to cope with rmmod -a races
  fails.  I.e. something like

	while (object doesn't exist) {
		if (request_module(module_name) < 0)
			break;
	}

  would screw up for something like

mount -t floppy <whatever>

  since we would happily load floppy.o and look for fs type called "floppy".
  And keep doing that forever, since floppy.o doesn't define any fs.

* we could try to protect against rmmod -a by changing semantics of module
  syscalls and modprobe(8).  Namely, let modprobe called by request_module()
  pin the module(s) down and make request_module() (actually its caller)
  decrement refcounts.  That would solve the problem, but we get another one:
  how to find all modules pulled in by modprobe(8) and its children.
  Notice that argument of request_module() doesn't help at all - it can have
  nothing to name of module we load (block-major-2 -> floppy) and we could have
  other modules grabbed by the same modprobe.

* we might try to pull the following trick: in sys_create_module() follow
  ->parent until we step on request_module()-spawned task.  Then put the new
  module on a list for that instance of request_module().  That would solve
  the problem, but I'm not too happy about such solution - IMO it's ugly.
  However, I don't see anything else...

Comments?

  


^ permalink raw reply	[flat|nested] 12+ messages in thread
[parent not found: <mailman.1019523121.12485.linux-kernel2news@redhat.com>]

end of thread, other threads:[~2002-04-29  2:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-23  0:49 [RFC] race in request_module() Alexander Viro
2002-04-23  0:58 ` Matthew Dharm
2002-04-23  1:05   ` Alexander Viro
2002-04-23  2:42     ` Matthew Dharm
2002-04-23  3:01       ` Alexander Viro
2002-04-23  3:30 ` Keith Owens
2002-04-23  3:35   ` Alexander Viro
2002-04-23  3:45     ` Keith Owens
2002-04-23 18:09       ` Alexander Viro
2002-04-23 22:56         ` Keith Owens
2002-04-29  2:42 ` Rusty Russell
     [not found] <mailman.1019523121.12485.linux-kernel2news@redhat.com>
2002-04-23  5:05 ` Pete Zaitcev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox