From: Dave Chinner <david@fromorbit.com>
To: Andreas Gruenbacher <agruenba@redhat.com>
Cc: Brian Foster <bfoster@redhat.com>, xfs@oss.sgi.com
Subject: Re: Inconsistencies with trusted.SGI_ACL_{FILE,DEFAULT}
Date: Wed, 28 Oct 2015 07:18:26 +1100 [thread overview]
Message-ID: <20151027201825.GO8773@dastard> (raw)
In-Reply-To: <CAHc6FU4ZgJDKphScucvDfEWPFFu4dGfDVund9Wrah=X-vxnz3w@mail.gmail.com>
On Tue, Oct 27, 2015 at 11:56:46AM +0100, Andreas Gruenbacher wrote:
> On Tue, Oct 27, 2015 at 6:30 AM, Dave Chinner <david@fromorbit.com> wrote:
> > On Tue, Oct 27, 2015 at 12:52:10AM +0100, Andreas Gruenbacher wrote:
> >> On Mon, Oct 26, 2015 at 10:32 PM, Dave Chinner <david@fromorbit.com> wrote:
> >> > Really, I'm struggling to understand what the problem is with XFS
> >> > doing translation to it's own special xattr names for ACLs
> >> > underneath the posix layer.
> >>
> >> Right now, setting one of the SGI_ACL attributes leads to stale i_acl
> >> / i_default_acl fields and in the case of SGI_ACL_FILE, possibly to
> >> outdated permissions in i_mode. You would get different information
> >> from getfacl than what's stored on disk.
> >
> > That's because we're not marking the cached acl as stale when
> > setting the acl directly...
> >
> >> > Yes, there's a caching issue when someone directly manipulates
> >> > the underlying xattr,
> >>
> >> "Directly manipulating" could be doing a setxattr of an attribute that
> >> was previously retrieved by getxattr, like restoring a backup.
> >
> > Sure, that's what xfsdump/restore effectively does.
> >
> >> > but you need root to shoot yourself in the foot that way, and that is easily
> >> > solveable.
> >>
> >> What do you mean, it's easily solvable?
> >
> > forget_all_cached_acls()
>
> Brian has already suggested that in this thread. Still leaves the
> i_mode permission bits stale and is broken wrt. uid/gid namespaces.
But for xfsrestore we don't want to do that because it's already
set the mode correctly. Indeed, we order operations in xfs_restore
to prevent the kernel from fucking with the inode modes and capabilities
and giving use the incorrect result once the backup is complete. e.g.:
struct stream_context {
bstat_t sc_bstat;
char sc_path[2 * MAXPATHLEN];
int sc_fd;
int sc_hsmflags;
/*
* we have to set the owner before we set extended attributes otherwise
* capabilities will not be restored correctly as setting the owner with
* fchmod will strip the capability attribute from the file. Hence we
* need to do this before restoring xattrs and record it so we don't do
* it again on completion of file restoration.
*/
bool_t sc_ownerset;
};
Further, user namespaces are irrelevant here - you can't run
xfsdump/restore outside the init_ns. xfsdump requires access to the
handle interface, which is unsafe to use inside a user ns because it
allows complete access to any inode in the filesystem without
limitations. xfs_restore requires unfettered access to directly
manipulate the uid/gid/security attrs of inodes, which once again is
something that isn't allowed inside user namespaces.
Setting Posix acls by directly poking the on-disk attr format rather
than going through the proper kernel ACL namespace is not a *general
purpose user interface*. Thi exists for backup/restore utilities to
do things like restore ACLs and security labels simply by treating
them as opaque xattrs. If a user sets ACLs using this low level
"opaque xattr" method, then they get to keep all the broken bits to
themselves.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2015-10-27 20:18 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-23 13:52 Inconsistencies with trusted.SGI_ACL_{FILE,DEFAULT} Andreas Gruenbacher
2015-10-24 12:57 ` Brian Foster
2015-10-24 13:58 ` Andreas Gruenbacher
2015-10-24 15:22 ` Brian Foster
2015-10-24 15:36 ` Brian Foster
2015-10-24 21:05 ` Andreas Gruenbacher
2015-10-24 21:16 ` [PATCH 0/4] xfs: SGI ACL Fixes Andreas Gruenbacher
2015-10-24 21:16 ` [PATCH 1/4] xfs: Validate the length of on-disk ACLs Andreas Gruenbacher
2015-10-24 21:16 ` [PATCH 2/4] xfs: SGI ACLs: Fix caching and mode setting Andreas Gruenbacher
2015-10-26 14:02 ` Brian Foster
2015-10-26 15:39 ` Andreas Gruenbacher
2015-10-26 19:00 ` Brian Foster
2015-10-24 21:16 ` [PATCH 3/4] xfs: SGI ACLs: Map uid/gid namespaces Andreas Gruenbacher
2015-10-26 21:46 ` Dave Chinner
2015-10-27 15:55 ` Andreas Gruenbacher
2015-10-27 19:55 ` Dave Chinner
2015-10-27 21:10 ` Andreas Gruenbacher
2015-10-27 22:37 ` Dave Chinner
2015-10-27 23:38 ` Andreas Gruenbacher
2015-10-24 21:16 ` [PATCH 4/4] xfs: SGI ACLs: Prepare for richacls Andreas Gruenbacher
2015-10-26 20:15 ` Andreas Gruenbacher
2015-10-26 14:02 ` [PATCH 0/4] xfs: SGI ACL Fixes Brian Foster
2015-10-26 21:32 ` Inconsistencies with trusted.SGI_ACL_{FILE,DEFAULT} Dave Chinner
2015-10-26 23:52 ` Andreas Gruenbacher
2015-10-27 5:30 ` Dave Chinner
2015-10-27 10:56 ` Andreas Gruenbacher
2015-10-27 20:18 ` Dave Chinner [this message]
2015-10-27 21:39 ` Andreas Gruenbacher
2015-10-27 22:38 ` Dave Chinner
2015-10-27 11:31 ` Brian Foster
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=20151027201825.GO8773@dastard \
--to=david@fromorbit.com \
--cc=agruenba@redhat.com \
--cc=bfoster@redhat.com \
--cc=xfs@oss.sgi.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