mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 19:42:15 -0700	[thread overview]
Message-ID: <20020422194214.D24927@one-eyed-alien.net> (raw)
In-Reply-To: <20020422175858.C24927@one-eyed-alien.net> <Pine.GSO.4.21.0204222101370.5686-100000@weyl.math.psu.edu>

[-- Attachment #1: Type: text/plain, Size: 2385 bytes --]

The question then becomes one of how do I distinguish a race condition from
a legitimate load/unload cycle?

I'm not certain that I see a way.  Unless we mark modules as "not used
yet", until the first piece of code in them is used.  But that feels like
an ugly hack, and seems likely to be problematic for some unusual
scenarios.

It looks like we might need another state for modules to be in.  Or simply
discourage people from auto-unloading "unused" modules.

I've seen this on usb-storage also, where the module count is maintained by
the SCSI layers -- it's only non-zero when someone/something is actively
using a device, which means that it will tend to get unloaded by an rmmod
-a if we're between CD burns, for example.  And, when the module is
unloaded, all sorts of state information is lost.  rmmod -a is my enemy in
this case.

Isn't the problem here just the misuse of rmmod -a?  Perhaps we should
attach a warning to the documentation to indicate the possible badness that
can happen.

Matt

On Mon, Apr 22, 2002 at 09:05:56PM -0400, Alexander Viro wrote:
> 
> 
> On Mon, 22 Apr 2002, Matthew Dharm wrote:
> 
> > 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.
> 
> Still doesn't solve the problem.  And BTW, there are userland races of
> similar kind - foo.o depends on bar.o, modprobe loads bar.o, goes to look
> for foo.o and gets bar.o removed from under it.
> 
> The thing being, relying on time doesn't help - e.g. we might have modules
> on automounted volume and delays may be really long if the thing happens
> at time when load is high.

-- 
Matthew Dharm                              Home: mdharm-usb@one-eyed-alien.net 
Maintainer, Linux USB Mass Storage Driver

I'm just trying to think of a way to say "up yours" without getting fired.
					-- Stef
User Friendly, 10/8/1998

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

  reply	other threads:[~2002-04-23  2:42 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
2002-04-23  1:05   ` Alexander Viro
2002-04-23  2:42     ` Matthew Dharm [this message]
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=20020422194214.D24927@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®