public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] mnt: Fix a memory stomp in umount
Date: Thu, 18 Dec 2014 20:15:17 +0000	[thread overview]
Message-ID: <20141218201517.GP22149@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20141218200110.GO22149@ZenIV.linux.org.uk>

On Thu, Dec 18, 2014 at 08:01:10PM +0000, Al Viro wrote:
> On Thu, Dec 18, 2014 at 10:57:19AM -0600, Eric W. Biederman wrote:
> > 
> > While reviewing the code of umount_tree I realized that when we append
> > to a preexisting unmounted list we do not change pprev of the former
> > first item in the list.
> > 
> > Which means later in namespace_unlock hlist_del_init(&mnt->mnt_hash) on
> > the former first item of the list will stomp unmounted.first leaving
> > it set to some random mount point which we are likely to free soon.
> > 
> > This isn't likely to hit, but if it does I don't know how anyone could
> > track it down.
> 
> All you need for that kind of loop to work is correct -next on all elements.

Mind you, I'm not saying that this isn't worth sanitizing.  Just that analysis
in your commit message is incorrect - we actually do _not_ stomp on memory
there.  It's brittle and it's only saved by having only very few things done
to that hlist, but the actual memory corruption does not happen.  Again, I'm
no defending that code; it's certaily better off making a properly-spliced
hlist rather than relying on precise sequence of operations in
namespace_unlock().

  reply	other threads:[~2014-12-18 20:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-18 16:57 [PATCH] mnt: Fix a memory stomp in umount Eric W. Biederman
     [not found] ` <CA+55aFz6grtss0SXqOizXMOOF4sxT3FC4GC4NCiMF2Huy1vE4A@mail.gmail.com>
2014-12-18 18:41   ` Linus Torvalds
2014-12-18 19:24     ` Eric W. Biederman
2014-12-18 19:34       ` Linus Torvalds
2014-12-18 21:05       ` Al Viro
2014-12-18 21:18         ` Eric W. Biederman
2014-12-19  0:02           ` Al Viro
2014-12-19  0:03             ` Al Viro
2015-01-02 21:06             ` Eric W. Biederman
2015-01-02 21:13               ` Al Viro
2015-01-02 21:56                 ` Eric W. Biederman
2014-12-18 20:01 ` Al Viro
2014-12-18 20:15   ` Al Viro [this message]
2014-12-18 20:40     ` Eric W. Biederman

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=20141218201517.GP22149@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=ebiederm@xmission.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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