From: Seth Forshee <seth.forshee@canonical.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Trond Myklebust <trondmy@primarydata.com>,
"bfields@fieldses.org" <bfields@fieldses.org>,
"anna.schumaker@netapp.com" <anna.schumaker@netapp.com>,
Steve French <sfrench@primarydata.com>,
"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
"dhowells@redhat.com" <dhowells@redhat.com>,
linux-fsdevel@vger.kernel.org
Subject: Re: [REVIEW][PATCH] fs: Better permission checking for submounts
Date: Wed, 1 Feb 2017 07:38:07 -0600 [thread overview]
Message-ID: <20170201133807.GA136075@ubuntu-hedt> (raw)
In-Reply-To: <87h94epg9y.fsf_-_@xmission.com>
On Wed, Feb 01, 2017 at 07:38:17PM +1300, Eric W. Biederman wrote:
>
> To support unprivileged users mounting filesystems two permission
> checks have to be performed: a test to see if the user allowed to
> create a mount in the mount namespace, and a test to see if
> the user is allowed to access the specified filesystem.
>
> The automount case is special in that mounting the original filesystem
> grants permission to mount the sub-filesystems, to any user who
> happens to stumble across the their mountpoint and satisfies the
> ordinary filesystem permission checks.
>
> Attempting to handle the automount case by using override_creds
> almost works. It preserves the idea that permission to mount
> the original filesystem is permission to mount the sub-filesystem.
> Unfortunately using override_creds messes up the filesystems
> ordinary permission checks.
>
> Solve this by being explicit that a mount is a submount by introducing
> vfs_submount, and using it where appropriate.
>
> vfs_submount uses a new mount internal mount flags MS_SUBMOUNT, to let
> sget and friends know that a mount is a submount so they can take appropriate
> action.
>
> sget and sget_userns are modified to not perform any permission checks
> on submounts.
>
> follow_automount is modified to stop using override_creds as that
> has proven problemantic.
>
> do_mount is modified to always remove the new MS_SUBMOUNT flag so
> that we know userspace will never by able to specify it.
>
> autofs4 is modified to stop using current_real_cred that was put in
> there to handle the previous version of submount permission checking.
>
> cifs is modified to pass the mountpoint all of the way down to vfs_submount.
>
> debugfs is modified to pass the mountpoint all of the way down to
> trace_automount by adding a new parameter. To make this change easier
> a new typedef debugfs_automount_t is introduced to capture the type of
> the debugfs automount function.
>
> Cc: stable@vger.kernel.org
> Fixes: 069d5ac9ae0d ("autofs: Fix automounts by using current_real_cred()->uid")
> Fixes: aeaa4a79ff6a ("fs: Call d_automount with the filesystems creds")
> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Looks good to me. I also got testing from the user who reported the bug
to us, and it does fix his nfs submount problem.
Reviewed-by: Seth Forshee <seth.forshee@canonical.com>
prev parent reply other threads:[~2017-02-01 13:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20170110145504.GH52661@ubuntu-hedt>
[not found] ` <87ziiyfntm.fsf@xmission.com>
[not found] ` <20170124151745.GA114560@ubuntu-hedt>
[not found] ` <87efzsdq5b.fsf@xmission.com>
[not found] ` <87inp4rqaj.fsf@xmission.com>
[not found] ` <1485301593.36478.2.camel@primarydata.com>
[not found] ` <87y3y0ko5s.fsf@xmission.com>
[not found] ` <1485303265.36478.7.camel@primarydata.com>
[not found] ` <20170125145251.GB51023@ubuntu-hedt>
[not found] ` <1485359474.113155.1.camel@primarydata.com>
[not found] ` <20170125162811.GC51023@ubuntu-hedt>
[not found] ` <87mve6pgci.fsf@xmission.com>
2017-02-01 6:38 ` [REVIEW][PATCH] fs: Better permission checking for submounts Eric W. Biederman
2017-02-01 13:28 ` Trond Myklebust
2017-02-01 13:38 ` Seth Forshee [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=20170201133807.GA136075@ubuntu-hedt \
--to=seth.forshee@canonical.com \
--cc=anna.schumaker@netapp.com \
--cc=bfields@fieldses.org \
--cc=dhowells@redhat.com \
--cc=ebiederm@xmission.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=sfrench@primarydata.com \
--cc=trondmy@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;
as well as URLs for NNTP newsgroup(s).