Linux NFS development
 help / color / mirror / Atom feed
From: Eric Paris <eparis@redhat.com>
To: Trond Myklebust <trond.myklebust@primarydata.com>, jlayton@redhat.com
Cc: Schumaker Anna <Anna.Schumaker@netapp.com>,
	David Quigley <dpquigl@davequigley.com>,
	Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
	James Morris <james.l.morris@oracle.com>
Subject: Re: [PATCH] nfs: Don't assume we have a security structure
Date: Tue, 11 Mar 2014 20:38:18 -0400	[thread overview]
Message-ID: <1394584698.10287.0.camel@localhost> (raw)
In-Reply-To: <EEEA2B4E-BE0F-40C0-91C3-98E2E7E8BB35@primarydata.com>

On Tue, 2014-03-11 at 18:00 -0400, Trond Myklebust wrote:
> On Mar 11, 2014, at 17:27, Trond Myklebust <trond.myklebust@primarydata.com> wrote:
> 
> > 
> > On Mar 11, 2014, at 17:11, Anna Schumaker <Anna.Schumaker@netapp.com> wrote:
> > 
> >> If the i_security field isn't set then security_dentry_init_security()
> >> won't initialize some of the values used by the security label.  This
> >> causes my client to hit a BUG_ON() while encoding a label of size
> >> -2128927414.
> >> 
> >> I hit this bug while testing on a client without SELinux installed.
> >> 
> >> Signed-off-by: Anna Schumaker <anna.schumaker@netapp.com>
> >> ---
> >> fs/nfs/nfs4proc.c | 3 +++
> >> 1 file changed, 3 insertions(+)
> >> 
> >> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> >> index b8cd560..994ccc2 100644
> >> --- a/fs/nfs/nfs4proc.c
> >> +++ b/fs/nfs/nfs4proc.c
> >> @@ -105,6 +105,9 @@ nfs4_label_init_security(struct inode *dir, struct dentry *dentry,
> >> 	if (nfs_server_capable(dir, NFS_CAP_SECURITY_LABEL) == 0)
> >> 		return NULL;
> >> 
> >> +	if (!dir->i_security)
> >> +		return NULL;
> >> +
> >> 	err = security_dentry_init_security(dentry, sattr->ia_mode,
> >> 				&dentry->d_name, (void **)&label->label, &label->len);
> >> 	if (err == 0)
> > 
> > Hi Anna,
> > 
> > This looks like a check that needs to be done by selinux_dentry_init_security() itself. The dir->i_security field is not something that NFS knows about.
> > David, what needs to happen there when dentry->d_parent->i_security (a.k.a. dsec) is NULL?
> > 
> 
> Oh, wait. I missed the bit about ‘without SELinux installed’. So the problem here is that you have a NFS client that does not have SELinux set up, but running against a server that is advertising NFSv4.2 with labeled NFS. Is that correct?
> 
> It looks to me as if cap_dentry_init_security() will indeed trigger this behaviour since it returns ‘0’ without doing anything to the label. As far as I can see, the right thing to do there is to return -EOPNOTSUPP, no?

I feel like Jeff Layton was looking at the same thing, and came to the
same conclusion...

Jeff?

-Eric


  reply	other threads:[~2014-03-12  0:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-11 21:11 [PATCH] nfs: Don't assume we have a security structure Anna Schumaker
2014-03-11 21:27 ` Trond Myklebust
2014-03-11 22:00   ` Trond Myklebust
2014-03-12  0:38     ` Eric Paris [this message]
2014-03-12  1:06       ` Jeffrey Layton
2014-03-12  9:21         ` Trond Myklebust
2014-03-12 10:22           ` Jeff Layton
2014-03-12 13:19             ` Anna Schumaker
2014-03-11 21:31 ` Weston Andros Adamson

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=1394584698.10287.0.camel@localhost \
    --to=eparis@redhat.com \
    --cc=Anna.Schumaker@netapp.com \
    --cc=dpquigl@davequigley.com \
    --cc=james.l.morris@oracle.com \
    --cc=jlayton@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@primarydata.com \
    /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