Linux NFS development
 help / color / mirror / Atom feed
From: Jeff Layton <jeff.layton@primarydata.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: "J. Bruce Fields" <bfields@fieldses.org>, linux-nfs@vger.kernel.org
Subject: Re: nfsd use after free in 4.0-rc
Date: Sat, 21 Mar 2015 10:06:57 -0400	[thread overview]
Message-ID: <20150321100657.32ff0340@tlielax.poochiereds.net> (raw)
In-Reply-To: <20150316182810.GA4690@infradead.org>

[-- Attachment #1: Type: text/plain, Size: 1634 bytes --]

On Mon, 16 Mar 2015 11:28:10 -0700
Christoph Hellwig <hch@infradead.org> wrote:

> On Mon, Mar 16, 2015 at 11:58:45AM -0400, J. Bruce Fields wrote:
> > > 3240		list_add(&stp->st_perstateowner, &oo->oo_owner.so_stateids);
> > > 3241		spin_lock(&fp->fi_lock);
> > > 3242		list_add(&stp->st_perfile, &fp->fi_stateids);
> > 
> > I assume you're testing only NFS v4.1?
> 
> Exactly. I'm testing with a version of this patch applied to force 4.1:
> 
> http://git.infradead.org/users/hch/pnfs.git/commitdiff/72ef9b95aaed593ac061bb380bc27ced4fd67b4b

I've been using 4.2, fwiw...

So far, this bug has turned out to be pretty elusive, I've looked all
over the so_count handling and I don't see anywhere that we've got a
refcount imbalance. I must be missing something, but it all looks right
AFAICT.

I've also instrumented the code to look for 0->1 transitions on the
so_count, and that hasn't fired. I also looked to see whether Bruce's
hunch about the nfsd4_find_existing_open thing might be a problem with
the sc_count going 0->1 since we're taking a reference there w/o
holding the cl_lock. I haven't seen that happen either.

Mostly when I see this bug without memory poisoning enabled, it
manifests itself as list corruption in one of the stateowner lists
during nfsd4_close. Curiously, the attached patch seems to make that
problem go away, but the generic/011 test seems to fail most of the
time with this in the log:

    Cannot chdir out of pid directory: Stale file handle

...but if I turn up poisoning of the nfsd4_openowners slab then I get
an oops similar to what HCH is seeing.

-- 
Jeff Layton <jeff.layton@primarydata.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-nfsd-poison-so_owner.data-before-freeing-it.patch --]
[-- Type: text/x-patch, Size: 0 bytes --]



      reply	other threads:[~2015-03-21 14:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-15 12:56 nfsd use after free in 4.0-rc Christoph Hellwig
2015-03-15 22:08 ` Jeff Layton
2015-03-16 11:46   ` Christoph Hellwig
2015-03-16 12:20     ` Jeff Layton
2015-03-16 12:27       ` Christoph Hellwig
2015-03-16 16:19         ` J. Bruce Fields
2015-03-16 16:53           ` Jeff Layton
2015-03-16 17:10             ` J. Bruce Fields
2015-03-16 17:37               ` Jeff Layton
2015-03-16 15:58     ` J. Bruce Fields
2015-03-16 18:28       ` Christoph Hellwig
2015-03-21 14:06         ` Jeff Layton [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=20150321100657.32ff0340@tlielax.poochiereds.net \
    --to=jeff.layton@primarydata.com \
    --cc=bfields@fieldses.org \
    --cc=hch@infradead.org \
    --cc=linux-nfs@vger.kernel.org \
    /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