mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Tejun Heo <htejun@gmail.com>
Cc: linux-kernel@vger.kernel.org, greg@kroah.com, cebbert@redhat.com,
	sandeen@redhat.com, maneesh@in.ibm.com, cs@tequila.co.jp
Subject: Re: [PATCHSET 2.6.22-rc4] sysfs: fix race conditions
Date: Sun, 10 Jun 2007 23:12:03 -0700	[thread overview]
Message-ID: <20070610231203.730d0aba.akpm@linux-foundation.org> (raw)
In-Reply-To: <20070611050107.GJ29122@htj.dyndns.org>

On Mon, 11 Jun 2007 14:01:07 +0900 Tejun Heo <htejun@gmail.com> wrote:

> Currently, there are several race conditions around dentry/inode
> reclamation.
> 
> a. sysfs_dirent->s_dentry dereferencing in sysfs_readdir()
> 
> b. sysfs_dirent->s_dentry dereferencing in sysfs_drop_dentry()
> 
> c. sysfs_dirent->s_dentry clearing in sysfs_d_iput()
> 
> All aboves are done without synchronization and can cause oops if the
> timing is right (or wrong).
> 
> These race conditions are difficult to trigger but with the attached
> patch (sysfs-races.patch) and the following commands running
> parallelly, all three are reliably reproducible (you may have to
> change timings or disable others to trigger specific one).
> 
> 1. while true; do insmod drivers/ata/libata.ko; insmod drivers/ata/ata_piix.ko; sleep 1; rmmod ata_piix; rmmod libata; sleep 1; echo -n . ; done
> 2. while true; do find /sys -type f | xargs cat > /dev/null; echo -n .; sleep 1; done
> 3. while true; do find /sys/class/scsi_disk -type f | sort | xargs cat > /dev/null; echo -n .; sleep 1; done
> 4. while true; do umount /sys; sleep 1; mount /sys; sleep 1; echo -n .; done
> 
> #1 assumes there are several devices attached to ata_piix controller.
> Change #1 to any module or command which creates and removes sysfs
> nodes repeatedly and adjust #3 to cat those sysfs nodes.
> 
> All known race conditions are fixed in the current -mm.  #a is
> replaced by adding sd->s_ino and allocating unique ino with ida.  #b
> and #c are fixed during sysfs_drop_dentry() rewrite.  However, those
> changes were too big to apply to 2.6.22-rcX or any stable branches.
> 
> This patchset contains three minimal backports of fixes in -mm.  With
> all patches in the patchset and sysfs-races.patch applied, kernel
> survived ~20 hours of stress test without any problem.

So these are being proposed for 2.6.22?

I do wonder about Rafael's bug which he bisected down to
gregkh-driver-sysfs-use-singly-linked-list-for-sysfs_dirent-tree.patch.

If that won't be a problem in this patchset then I spose it's probably best
to go ahead with a 2.6.22 merge, but it's more a Greg thing than a me
thing.

I don't have a tree to merge these patches into, unless I drop all the
patches which are in Greg's tree.

Greg, can I leave it up to you to decide how we are to proceed here?

  parent reply	other threads:[~2007-06-11  6:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-11  5:01 Tejun Heo
2007-06-11  5:02 ` [PATCH 1/3] sysfs: store sysfs inode nrs in s_ino to avoid readdir oopses Tejun Heo
2007-06-11  5:03 ` [PATCH 2/3] sysfs: fix condition check in sysfs_drop_dentry() Tejun Heo
2007-06-11  5:04 ` [PATCH 3/3] sysfs: fix race condition around sd->s_dentry, take#2 Tejun Heo
2007-06-11  6:12 ` Andrew Morton [this message]
2007-06-11  6:15   ` [PATCHSET 2.6.22-rc4] sysfs: fix race conditions Tejun Heo
2007-06-12  0:54     ` Greg KH
2007-06-12 23:47     ` Greg KH
2007-06-13  4:50       ` Tejun Heo
2007-06-11  9:58 ` Eduard-Gabriel Munteanu
2007-06-11 10:02   ` Tejun Heo
2007-06-11 10:14     ` Eduard-Gabriel Munteanu

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=20070610231203.730d0aba.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=cebbert@redhat.com \
    --cc=cs@tequila.co.jp \
    --cc=greg@kroah.com \
    --cc=htejun@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maneesh@in.ibm.com \
    --cc=sandeen@redhat.com \
    /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

Powered by JetHome