mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: viro@parcelfarce.linux.theplanet.co.uk
To: "Stephen C. Tweedie" <sct@redhat.com>
Cc: SE Linux <selinux@tycho.nsa.gov>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>, Alexander Viro <aviro@redhat.com>
Subject: Re: [patch] Fix block device inode list corruptions
Date: Wed, 4 Feb 2004 22:19:19 +0000	[thread overview]
Message-ID: <20040204221919.GB21151@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <1075908464.1998.189.camel@sisko.scot.redhat.com>

On Wed, Feb 04, 2004 at 03:27:44PM +0000, Stephen C. Tweedie wrote:
> Hi,
> 
> I've been chasing a weird SELinux bug which shows up mostly when doing
> installs of a dev-* rpm (ie. creating and overwriting lots of block
> device inodes), but which I've also seen when doing mkinitrd.
> 
> It turned out not to be an SELinux problem at all, but a core VFS
> S_ISBLK bug.  It seems that SELinux simply widens the race window.
> 
> The code at fault is fs/fs-writeback.c:__mark_inode_dirty():
> 
> 		/*
> 		 * Only add valid (hashed) inodes to the superblock's
> 		 * dirty list.  Add blockdev inodes as well.
> 		 */
> 		if (!S_ISBLK(inode->i_mode)) {
> 			if (hlist_unhashed(&inode->i_hash))
> 				goto out;
> 			if (inode->i_state & (I_FREEING|I_CLEAR))
> 				goto out;
> 		}
> 
> The "I_FREEING|I_CLEAR" condition was added after the ISBLK/unhashed
> tests were already in the source, but I can't see any reason why we'd
> want the I_FREEING test not to apply to block devices.  And indeed, this
> results in all sorts of inode list corruptions.  Simply moving the
> I_FREEING|I_CLEAR test out of the protection of the S_ISBLK() condition
> fixes things entirely.  

ACK.

      reply	other threads:[~2004-02-04 22:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-04 15:27 Stephen C. Tweedie
2004-02-04 22:19 ` viro [this message]

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=20040204221919.GB21151@parcelfarce.linux.theplanet.co.uk \
    --to=viro@parcelfarce.linux.theplanet.co.uk \
    --cc=akpm@osdl.org \
    --cc=aviro@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sct@redhat.com \
    --cc=selinux@tycho.nsa.gov \
    /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®