From: Matthew Dharm <mdharm-kernel@one-eyed-alien.net>
To: Alexander Viro <viro@math.psu.edu>
Cc: Linus Torvalds <torvalds@transmeta.com>,
Keith Owens <kaos@ocs.com.au>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC] race in request_module()
Date: Mon, 22 Apr 2002 17:58:59 -0700 [thread overview]
Message-ID: <20020422175858.C24927@one-eyed-alien.net> (raw)
In-Reply-To: <Pine.GSO.4.21.0204222027360.5686-100000@weyl.math.psu.edu>
[-- Attachment #1: Type: text/plain, Size: 2828 bytes --]
Isn't the real problem here that we've got a "rogue" running around
removing things that we might be about to use?
Yes, I think that request_module() should indicate to the caller if
something "suitable" was found. But I think having rmmod -a running around
sweeping things randomly is bad.
Perhaps what we need is a way to tell _how_long_ago_ the count on a module
last changed. Thus, rmmod -a could decide to only remove modules that were
last used more than an hour ago, or somesuch. Push the policy question into
userspace.
Matt
On Mon, Apr 22, 2002 at 08:49:40PM -0400, Alexander Viro wrote:
> 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?
>
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
Matthew Dharm Home: mdharm-usb@one-eyed-alien.net
Maintainer, Linux USB Mass Storage Driver
YOU SEE!!?? It's like being born with only one nipple!
-- Erwin
User Friendly, 10/19/1998
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
next prev parent reply other threads:[~2002-04-23 0:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-23 0:49 Alexander Viro
2002-04-23 0:58 ` Matthew Dharm [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020422175858.C24927@one-eyed-alien.net \
--to=mdharm-kernel@one-eyed-alien.net \
--cc=kaos@ocs.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
--cc=viro@math.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®