linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Sami Liedes <sami.liedes@iki.fi>, linux-fsdevel@vger.kernel.org
Subject: Deadlock in VFS on corrupted filesystem
Date: Thu, 10 May 2012 10:01:19 +0200	[thread overview]
Message-ID: <20120510080119.GA1969@quack.suse.cz> (raw)

  Hello Al!

  Sami found in his testing a rather easy way to deadlock a system with
corrupted filesystem: Just have a directory D and inside D a directory
entry pointing to D itself (e.g. corrupt '.' directory entry to have other
name). Then when you try to remove the corrupted directory entry system
will deadlock because we will try to lock D both as a parent and a child.

Generally, when the directory structure is corrupted so that cycles are
created, our locking protocol is prone to deadlocks. This is somewhat
unpleasant if you have a system where you allow mounting untrusted media.
So my question is: Do we care? And if yes, how to best fix this? My naive
idea would be that we could check in d_instantiate() whether we are
creating a directory dentry and if yes, check that inode is not already
attached to a directory hierarchy (i.e. effectively forbid directory
hardlinks). But this might be a bit tricky given dentry aliases. So what
are your thoughts?

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

             reply	other threads:[~2012-05-10  8:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-10  8:01 Jan Kara [this message]
2012-05-13 15:05 ` Deadlock in VFS on corrupted filesystem Sami Liedes

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=20120510080119.GA1969@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=sami.liedes@iki.fi \
    --cc=viro@ZenIV.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).