mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Adam J. Richter" <adam@yggdrasil.com>
To: rgooch@atnf.csiro.au
Cc: linux-kernel@vger.kernel.org, rusty@rustcorp.com.au, viro@math.psu.edu
Subject: Module unload race with devfs + char devices
Date: Tue, 24 Dec 2002 14:33:56 -0800	[thread overview]
Message-ID: <200212242233.OAA17934@adam.yggdrasil.com> (raw)

Hi Richard,

	This is pretty obscure, but I thought I should mention this
bug to you.

	I think there is a module unload race for character devices in
devfs whereby devfs retains a file_operations pointer that is no longer
valid after a character device driver module has been unloaded.

	I was able to trip the problem by adding a 10 second
sleep near the beginning of dentry_open (in fs/open.c) whenever a
parallel port was opened.  Then I was able to produce a kernel paging
error by doing the following:

modprobe parport_pc
modprobe lp
cat /dev/printers/0 &
rmmod lp

	Ten seconds later, I'd get a bad pointer reference on the
address previously occupied by lp_fops.  dentry_open would call
devfs_open; devfs_open would try to read lp_fops presumably because
some pointer to it had not been cleared.

	The problem does not occur without devfs because the regular
chrdev_open calls get_chrfops which fetches the appropriate takes a
semaphore that is used by {,un}register_chrdev, and, with that
semaphore held, fetches the appropriate f_ops and increments the
module's reference count before releasing the semaphore.  I had
previously thought that this was a more general problem, but now I now
think it's limited to devfs, so I thought I ought to let you know.

Adam J. Richter     __     ______________   575 Oroville Road
adam@yggdrasil.com     \ /                  Milpitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America
                         "Free Software For The Rest Of Us."

                 reply	other threads:[~2002-12-24 22:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200212242233.OAA17934@adam.yggdrasil.com \
    --to=adam@yggdrasil.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rgooch@atnf.csiro.au \
    --cc=rusty@rustcorp.com.au \
    --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®