From: Jeff Layton <jlayton@redhat.com>
To: Sage Weil <sweil@redhat.com>, Gregory Farnum <gfarnum@redhat.com>
Cc: "Yan, Zheng" <ukernel@gmail.com>,
ceph-devel <ceph-devel@vger.kernel.org>,
Ilya Dryomov <idryomov@gmail.com>, Zheng Yan <zyan@redhat.com>
Subject: Re: [RFC PATCH 07/10] ceph: update cap message struct version to 9
Date: Fri, 11 Nov 2016 07:45:17 -0500 [thread overview]
Message-ID: <1478868317.2482.23.camel@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.11.1611072318290.29278@piezo.us.to>
On Mon, 2016-11-07 at 23:21 +0000, Sage Weil wrote:
> On Mon, 7 Nov 2016, Gregory Farnum wrote:
> > On Mon, Nov 7, 2016 at 1:21 PM, Sage Weil <sweil@redhat.com> wrote:
> > > On Mon, 7 Nov 2016, Jeff Layton wrote:
> > >> On Mon, 2016-11-07 at 20:09 +0000, Sage Weil wrote:
> > >> > On Mon, 7 Nov 2016, Gregory Farnum wrote:
> > >> > > On Mon, Nov 7, 2016 at 10:39 AM, Jeff Layton <jlayton@redhat.com> wrote:
> > >> > > > On Mon, 2016-11-07 at 14:36 +0000, Sage Weil wrote:
> > >> > > >> On Mon, 7 Nov 2016, Jeff Layton wrote:
> > >> > > >> > On Mon, 2016-11-07 at 14:05 +0000, Sage Weil wrote:
> > >> > > >> > > On Mon, 7 Nov 2016, Jeff Layton wrote:
> > >> > > >> > > > On Mon, 2016-11-07 at 16:43 +0800, Yan, Zheng wrote:
> > >> > > >> > > > > On Fri, Nov 4, 2016 at 8:57 PM, Jeff Layton <jlayton@redhat.com> wrote:
> > >> > > >> > > > > >
>
> [okay, time to prune this a bit]
>
> > >> It still seems to me like that should just be a check for superuser
> > >> status. Something like:
> > >>
> > >> if (mask & MAY_CHOWN) {
> > >> // only root can chown
> > >> if (i->match.uid != 0 || caller_uid != 0)
> > >> continue;
> > >> }
> > >> }
> > >>
> > >> i.e. only allow chown if the capability has a uid of 0 and the
> > >> caller_uid is also 0.
> > >>
> > >> I don't think we want to ever grant an unprivileged user the ability to
> > >> chown, do we?
> > >
> > > Ah, yep. Except that the Locker.cc caller needs to be fixed to only ask
> > > for MAY_CHOWN if the uid is changing. Right now it's only passing
> > > MAY_WRITE which looks wrong too...
> >
> > Don't we want to let users chown between their own UIDs? A POSIX
> > superuser — ie root — really has very little meaning in terms of CephX
> > permissions. But it's perfectly legitimate for a tenant with 3 users
> > to chmod files between those 3. :/
>
> Maybe, but it'd be a different kind of check though, because it depends on
> multiple caps in order to permit the operation. So we'd need a couple
> function-global bools like chown_src_allowed and chown_dst_allowed or
> something like that.
>
> I'm not sure it would work even then, though, because on the client the
> user would still have to sudo chown ... to get past the client kernel's
> checks (I assume?).
>
>
Not necessarily. Most kernel filesystems call setattr_prepare, which is
where the CAP_CHOWN check happens, but (e.g.) NFS doesn't call it as it
always delegates the permission checking for setattr to the server.
Looks like both the in-kernel and Ceph client and FUSE always call that
function, so CAP_CHOWN permissions are always checked client-side there.
Still, with libcephfs a program need not deal with the kernel at all, so
you can't really rely on that.
Isn't this potentially silent metadata corruption? You could end up with
a program that issues an ownership change that appears to work, only to
find later that it got reverted because the mds decided it didn't want
to apply it once the caps got updated.
I think the simplest solution would be to just not issue exclusive caps
at all if you aren't prepared to accept cached updates from the client
for the corresponding metadata. Those clients would get shared caps
only. So, you could have clients to which you allow Fx caps, but only
As?
--
Jeff Layton <jlayton@redhat.com>
next prev parent reply other threads:[~2016-11-11 12:45 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-07 21:21 [RFC PATCH 07/10] ceph: update cap message struct version to 9 Sage Weil
2016-11-07 21:51 ` Jeff Layton
2016-11-07 23:15 ` Gregory Farnum
2016-11-07 23:21 ` Sage Weil
2016-11-11 12:45 ` Jeff Layton [this message]
2016-11-11 14:48 ` Sage Weil
2016-11-11 15:00 ` handling MDS permission check failures in cap updates (was: [RFC PATCH 07/10] ceph: update cap message struct version to 9) Jeff Layton
2016-11-11 15:07 ` Sage Weil
2016-11-11 15:39 ` Jeff Layton
2016-11-11 16:02 ` Sage Weil
2016-11-12 1:16 ` Jeff Layton
-- strict thread matches above, loose matches on Subject: below --
2016-11-04 11:34 [RFC PATCH 00/10] ceph: fix long stalls during fsync and write_inode Jeff Layton
2016-11-04 11:34 ` [RFC PATCH 07/10] ceph: update cap message struct version to 9 Jeff Layton
2016-11-04 12:57 ` Jeff Layton
2016-11-07 8:43 ` Yan, Zheng
2016-11-07 11:21 ` Jeff Layton
2016-11-07 14:05 ` Sage Weil
2016-11-07 14:22 ` Jeff Layton
2016-11-07 14:36 ` Sage Weil
2016-11-07 18:39 ` Jeff Layton
2016-11-07 19:15 ` Sage Weil
2016-11-07 19:53 ` Gregory Farnum
2016-11-07 20:09 ` Sage Weil
2016-11-07 21:16 ` Jeff Layton
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=1478868317.2482.23.camel@redhat.com \
--to=jlayton@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=gfarnum@redhat.com \
--cc=idryomov@gmail.com \
--cc=sweil@redhat.com \
--cc=ukernel@gmail.com \
--cc=zyan@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.