Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1585780

Re: [RFC v2 1/1] shiftfs: uid/gid shifting bind mount

Path csiph.com!1.us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From James Bottomley <James.Bottomley@HansenPartnership.com>
Newsgroups linux.kernel
Subject Re: [RFC v2 1/1] shiftfs: uid/gid shifting bind mount
Date Tue, 21 Feb 2017 23:30:01 +0100
Message-ID <tdr6x-on-3@gated-at.bofh.it> (permalink)
References <td6Ot-3u9-3@gated-at.bofh.it> <td6Ot-3u9-5@gated-at.bofh.it> <tdlaO-4Vr-23@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1487715810; bh=Wp9zwwbep3dSuhXZKa5NsL7Runx053Afbbz659sLOwQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=U5NfAhgBKNoA16mES9Pcs7WF9KlteS0rt5sJDnAo1QFXjFSoI4CT/CVYphYb2ISv4 RKIA3bv3aG79SAQVvPLB4Fmj7HUMy8P2Gi4NRG4LgqzvUqEgbfv/e9GlgwNDVxoV8w dn0cF8vp1OtWNWfKrZjK16NqXubGyGk9ii2frtGo=
Content-Type text/plain; charset="UTF-8"
X-Mailer Evolution 3.16.5
MIME-Version 1.0
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 48
Organization linux.* mail to news gateway
X-Original-Cc Djalal Harouni <tixxdz@gmail.com>, Chris Mason <clm@fb.com>, Theodore Tso <tytso@mit.edu>, Josh Triplett <josh@joshtriplett.org>, "Eric W. Biederman" <ebiederm@xmission.com>, Andy Lutomirski <luto@kernel.org>, Seth Forshee <seth.forshee@canonical.com>, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Dongsu Park <dongsu@endocode.com>, David Herrmann <dh.herrmann@googlemail.com>, Miklos Szeredi <mszeredi@redhat.com>, Alban Crequy <alban.crequy@gmail.com>, Al Viro <viro@ZenIV.linux.org.uk>, "Serge E. Hallyn" <serge@hallyn.com>, Phil Estes <estesp@gmail.com>, Amir Goldstein <amir73il@gmail.com>
X-Original-Date Tue, 21 Feb 2017 17:23:26 -0500
X-Original-Message-ID <1487715806.2373.15.camel@HansenPartnership.com>
X-Original-References <1487637902.2337.47.camel@HansenPartnership.com> <1487638025.2337.49.camel@HansenPartnership.com> <20170221160649.GC28653@redhat.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1585780

Show key headers only | View raw


On Tue, 2017-02-21 at 11:06 -0500, Vivek Goyal wrote:
> On Mon, Feb 20, 2017 at 04:47:05PM -0800, James Bottomley wrote:
> 
> [..]
> > +static struct dentry *shiftfs_lookup(struct inode *dir, struct
> > dentry *dentry,
> > +				     unsigned int flags)
> > +{
> > +	struct dentry *real = dir->i_private, *new;
> > +	struct inode *reali = real->d_inode, *newi;
> 
> newi needs to be initialized to NULL. Otherwise if a file does not
> exist, we try to call d_splice_alias() with uninitialized value of
> newi.
> 
> This crashes for the new file creation case.

I think you've still got an older version.  The code around that region
should read:

	

	oldcred = shiftfs_new_creds(&newcred, dentry->d_sb);
	new = lookup_one_len(dentry->d_name.name, real, dentry->d_name.len);
	shiftfs_old_creds(oldcred, &newcred);
	inode_unlock(reali);

	if (IS_ERR(new))
		return new;

	dentry->d_fsdata = new;

	newi = NULL;
	if (!new->d_inode)
		goto out;

	newi = shiftfs_new_inode(dentry->d_sb, new->d_inode->i_mode, new);
	if (!newi) {
		dput(new);
		return ERR_PTR(-ENOMEM);
	}

 out:
	return d_splice_alias(newi, dentry);

So newi is set to NULL before out is taken.  I checked: this hunk did make it to the v2 patch.

James

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC v2 0/1] shiftfs: uid/gid shifting filesystem (s_user_ns  version) James Bottomley <James.Bottomley@HansenPartnership.com> - 2017-02-21 01:50 +0100
  [RFC v2 1/1] shiftfs: uid/gid shifting bind mount James Bottomley <James.Bottomley@HansenPartnership.com> - 2017-02-21 01:50 +0100
    Re: [RFC v2 1/1] shiftfs: uid/gid shifting bind mount Vivek Goyal <vgoyal@redhat.com> - 2017-02-21 17:10 +0100
      Re: [RFC v2 1/1] shiftfs: uid/gid shifting bind mount James Bottomley <James.Bottomley@HansenPartnership.com> - 2017-02-21 23:30 +0100
        Re: [RFC v2 1/1] shiftfs: uid/gid shifting bind mount Vivek Goyal <vgoyal@redhat.com> - 2017-02-22 17:50 +0100

csiph-web