From: Linus Torvalds <torvalds@linux-foundation.org>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
ebiederm@xmission.com, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org
Subject: Re: 2.6.27-rc7-sha1: EIP at proc_sys_compare+0x36/0x50
Date: Sun, 28 Sep 2008 13:46:34 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.1.10.0809281338350.3265@nehalem.linux-foundation.org> (raw)
In-Reply-To: <20080928141856.GG28946@ZenIV.linux.org.uk>
On Sun, 28 Sep 2008, Al Viro wrote:
>
> > Al, did I miss something?
>
> The real underlying bug, whatever it is. If this sucker ever becomes
> negative, we have a big problem. Where _could_ that happen? Remember,
> we do not allow ->rmdir() and ->unlink() to succeed there.
What about pure memory pressure? We're holding only the RCU read-side lock
when looking up dentries, and if there is any memory pressure, the
dentries may be unhashed and the inodes removed in parallel. Yes, yes, we
end up not actually _releasing_ the dentry, since it's all RCU, but it
will set D_UNHASHED and be scheduled for releasing later under RCU.
And d_compare() is called before we have done any validation that the name
is still active, including checking whether it even got released already!
I dunno. Do we want to move the D_UNHASHED check up earlier? Or am I still
missing something?
Linus
----
fs/dcache.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/fs/dcache.c b/fs/dcache.c
index 80e9395..e7a1a99 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1395,6 +1395,10 @@ struct dentry * __d_lookup(struct dentry * parent, struct qstr * name)
if (dentry->d_parent != parent)
goto next;
+ /* non-existing due to RCU? */
+ if (d_unhashed(dentry))
+ goto next;
+
/*
* It is safe to compare names since d_move() cannot
* change the qstr (protected by d_lock).
@@ -1410,10 +1414,8 @@ struct dentry * __d_lookup(struct dentry * parent, struct qstr * name)
goto next;
}
- if (!d_unhashed(dentry)) {
- atomic_inc(&dentry->d_count);
- found = dentry;
- }
+ atomic_inc(&dentry->d_count);
+ found = dentry;
spin_unlock(&dentry->d_lock);
break;
next:
next prev parent reply other threads:[~2008-09-28 20:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-26 15:20 Alexey Dobriyan
2008-09-26 15:47 ` Linus Torvalds
2008-09-27 8:44 ` Eric W. Biederman
2008-09-28 20:38 ` Linus Torvalds
2008-09-28 14:18 ` Al Viro
2008-09-28 19:28 ` Hugh Dickins
2008-09-28 20:55 ` Linus Torvalds
2008-09-28 20:59 ` Linus Torvalds
2008-09-28 22:07 ` Hugh Dickins
2008-09-29 3:05 ` Eric W. Biederman
2008-09-28 20:46 ` Linus Torvalds [this message]
2008-09-28 20:50 ` Linus Torvalds
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=alpine.LFD.1.10.0809281338350.3265@nehalem.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--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
Powered by JetHome