All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miklos Szeredi <mszeredi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
Cc: Miklos Szeredi <miklos-sUDqSbJrdHQHWmgEVkV9KA@public.gmane.org>,
	Linux Containers
	<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	lkml <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Seth Forshee
	<seth.forshee-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>,
	Alban Crequy <alban-lYLaGTFnO9sWenYVfaLwtA@public.gmane.org>,
	Sargun Dhillon <sargun-GaZTRHToo+CzQB+pC5nmwQ@public.gmane.org>,
	linux-fsdevel
	<linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] fuse: Ensure posix acls are translated outside of init_user_ns
Date: Tue, 29 May 2018 14:55:25 +0200	[thread overview]
Message-ID: <CAOssrKdS9gOsZrNfqJbk_j0Z8-hrqrYWW+=_Z5mUEX1KE-Kw6Q__46197.5509104834$1527598590$gmane$org@mail.gmail.com> (raw)
In-Reply-To: <877enmskec.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>

On Tue, May 29, 2018 at 2:42 PM, Eric W. Biederman
<ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org> wrote:
> ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman) writes:
>
>> ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman) writes:
>>
>>> Ensure the translation happens by failing to read or write
>>> posix acls when the filesystem has not indicated it supports
>>> posix acls.
>>>
>>> This ensures that modern cached posix acl support is available
>>> and used when dealing with posix acls.  This is important
>>> because only that path has the code to convernt the uids and
>>> gids in posix acls into the user namespace of a fuse filesystem.
>>>
>>> Signed-off-by: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
>>> ---
>>
>> ping.
>>
>> Miklos are you around where you can look at this?
>
> Perhaps I got the wrong email address.


No, sorry.  I'll queue this up for 4.18.

Just wanted to finish off overlayfs stuff before getting into fuse.

Thanks,
Miklos

>
>>
>>> Miklos after several attempts to handle this better last cycle.  I
>>> figure we should go with the stupid version for now.  I think I know
>>> how to do better but I don't want that to gate forward progress on
>>> fully unprivileged fuse mounts.  Especially as this is the last known
>>> issue to deal with.
>>>
>>>  fs/fuse/fuse_i.h |  1 +
>>>  fs/fuse/inode.c  |  7 +++++++
>>>  fs/fuse/xattr.c  | 43 +++++++++++++++++++++++++++++++++++++++++++
>>>  3 files changed, 51 insertions(+)
>>>
>>> diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
>>> index f630951df8dc..5256ad333b05 100644
>>> --- a/fs/fuse/fuse_i.h
>>> +++ b/fs/fuse/fuse_i.h
>>> @@ -985,6 +985,7 @@ ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size);
>>>  int fuse_removexattr(struct inode *inode, const char *name);
>>>  extern const struct xattr_handler *fuse_xattr_handlers[];
>>>  extern const struct xattr_handler *fuse_acl_xattr_handlers[];
>>> +extern const struct xattr_handler *fuse_no_acl_xattr_handlers[];
>>>
>>>  struct posix_acl;
>>>  struct posix_acl *fuse_get_acl(struct inode *inode, int type);
>>> diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
>>> index 1643043d4fe5..22c76cf8c2e3 100644
>>> --- a/fs/fuse/inode.c
>>> +++ b/fs/fuse/inode.c
>>> @@ -1100,6 +1100,13 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
>>>          file->f_cred->user_ns != sb->s_user_ns)
>>>              goto err_fput;
>>>
>>> +    /*
>>> +     * If we are not in the initial user namespace posix
>>> +     * acls must be translated.
>>> +     */
>>> +    if (sb->s_user_ns != &init_user_ns)
>>> +            sb->s_xattr = fuse_no_acl_xattr_handlers;
>>> +
>>>      fc = kmalloc(sizeof(*fc), GFP_KERNEL);
>>>      err = -ENOMEM;
>>>      if (!fc)
>>> diff --git a/fs/fuse/xattr.c b/fs/fuse/xattr.c
>>> index 3caac46b08b0..433717640f78 100644
>>> --- a/fs/fuse/xattr.c
>>> +++ b/fs/fuse/xattr.c
>>> @@ -192,6 +192,26 @@ static int fuse_xattr_set(const struct xattr_handler *handler,
>>>      return fuse_setxattr(inode, name, value, size, flags);
>>>  }
>>>
>>> +static bool no_xattr_list(struct dentry *dentry)
>>> +{
>>> +    return false;
>>> +}
>>> +
>>> +static int no_xattr_get(const struct xattr_handler *handler,
>>> +                    struct dentry *dentry, struct inode *inode,
>>> +                    const char *name, void *value, size_t size)
>>> +{
>>> +    return -EOPNOTSUPP;
>>> +}
>>> +
>>> +static int no_xattr_set(const struct xattr_handler *handler,
>>> +                    struct dentry *dentry, struct inode *nodee,
>>> +                    const char *name, const void *value,
>>> +                    size_t size, int flags)
>>> +{
>>> +    return -EOPNOTSUPP;
>>> +}
>>> +
>>>  static const struct xattr_handler fuse_xattr_handler = {
>>>      .prefix = "",
>>>      .get    = fuse_xattr_get,
>>> @@ -209,3 +229,26 @@ const struct xattr_handler *fuse_acl_xattr_handlers[] = {
>>>      &fuse_xattr_handler,
>>>      NULL
>>>  };
>>> +
>>> +static const struct xattr_handler fuse_no_acl_access_xattr_handler = {
>>> +    .name  = XATTR_NAME_POSIX_ACL_ACCESS,
>>> +    .flags = ACL_TYPE_ACCESS,
>>> +    .list  = no_xattr_list,
>>> +    .get   = no_xattr_get,
>>> +    .set   = no_xattr_set,
>>> +};
>>> +
>>> +static const struct xattr_handler fuse_no_acl_default_xattr_handler = {
>>> +    .name  = XATTR_NAME_POSIX_ACL_DEFAULT,
>>> +    .flags = ACL_TYPE_ACCESS,
>>> +    .list  = no_xattr_list,
>>> +    .get   = no_xattr_get,
>>> +    .set   = no_xattr_set,
>>> +};
>>> +
>>> +const struct xattr_handler *fuse_no_acl_xattr_handlers[] = {
>>> +    &fuse_no_acl_access_xattr_handler,
>>> +    &fuse_no_acl_default_xattr_handler,
>>> +    &fuse_xattr_handler,
>>> +    NULL
>>> +};

  parent reply	other threads:[~2018-05-29 12:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-04 16:47 [PATCH] fuse: Ensure posix acls are translated outside of init_user_ns Eric W. Biederman
2018-05-08 13:37 ` Seth Forshee
2018-05-23 16:11 ` Eric W. Biederman
2018-05-29 12:42   ` Eric W. Biederman
2018-05-29 12:55     ` Miklos Szeredi
2018-05-29 14:02       ` Eric W. Biederman
     [not found]         ` <87zi0io90k.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2018-05-29 14:04           ` [PATCH] fuse: Allow fully unprivileged mounts Eric W. Biederman
2018-05-29 14:04             ` Eric W. Biederman
     [not found]             ` <87tvqqo8w1.fsf_-_-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2018-05-31 14:45               ` Miklos Szeredi
2018-05-31 14:45             ` Miklos Szeredi
     [not found]       ` <CAOssrKdS9gOsZrNfqJbk_j0Z8-hrqrYWW+=_Z5mUEX1KE-Kw6Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-05-29 14:02         ` [PATCH] fuse: Ensure posix acls are translated outside of init_user_ns Eric W. Biederman
     [not found]     ` <877enmskec.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2018-05-29 12:55       ` Miklos Szeredi [this message]
     [not found]   ` <87wovubbdf.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2018-05-29 12:42     ` Eric W. Biederman
     [not found] ` <87r2mre5b3.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2018-05-08 13:37   ` Seth Forshee
2018-05-23 16:11   ` Eric W. Biederman
  -- strict thread matches above, loose matches on Subject: below --
2018-05-04 16:47 Eric W. Biederman

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='CAOssrKdS9gOsZrNfqJbk_j0Z8-hrqrYWW+=_Z5mUEX1KE-Kw6Q__46197.5509104834$1527598590$gmane$org@mail.gmail.com' \
    --to=mszeredi-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=alban-lYLaGTFnO9sWenYVfaLwtA@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=miklos-sUDqSbJrdHQHWmgEVkV9KA@public.gmane.org \
    --cc=sargun-GaZTRHToo+CzQB+pC5nmwQ@public.gmane.org \
    --cc=seth.forshee-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org \
    /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.