Re: [PATCH] fs: move the posix_acl_fix_xattr_{to_from}_user out of xattr code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 24, 2020 at 8:50 AM Christoph Hellwig <hch@xxxxxx> wrote:
>
> There is no excuse to ever perform actions related to a specific handler
> directly from the generic xattr code as we have handler that understand
> the specific data in given attrs.  As a nice sideeffect this removes
> tons of pointless boilerplate code.
>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---
>
> Changes since v1:
>  - fix up file systems that have their own ACL xattr handlers
>
>  fs/9p/acl.c                     |  4 +--
>  fs/overlayfs/dir.c              |  2 +-
>  fs/overlayfs/super.c            |  2 +-
>  fs/posix_acl.c                  | 62 ++-------------------------------
>  fs/xattr.c                      |  8 +----
>  include/linux/posix_acl_xattr.h | 12 -------
>  6 files changed, 7 insertions(+), 83 deletions(-)
>
> diff --git a/fs/9p/acl.c b/fs/9p/acl.c
> index 6261719f6f2a..f3455ba2a84d 100644
> --- a/fs/9p/acl.c
> +++ b/fs/9p/acl.c
> @@ -232,7 +232,7 @@ static int v9fs_xattr_get_acl(const struct xattr_handler *handler,
>                 return PTR_ERR(acl);
>         if (acl == NULL)
>                 return -ENODATA;
> -       error = posix_acl_to_xattr(&init_user_ns, acl, buffer, size);
> +       error = posix_acl_to_xattr(current_user_ns(), acl, buffer, size);

Okay, but the uncached cache is still broken.  It needs the xattr to
be converted to acl (posix_acl_to_xattr(&init_user_ns, ...)) then back
to xattr here.

>         posix_acl_release(acl);
>
>         return error;
> @@ -262,7 +262,7 @@ static int v9fs_xattr_set_acl(const struct xattr_handler *handler,
>                 return -EPERM;
>         if (value) {
>                 /* update the cached acl value */
> -               acl = posix_acl_from_xattr(&init_user_ns, value, size);
> +               acl = posix_acl_from_xattr(current_user_ns(), value, size);

Same in this function.

Thanks,
Miklos



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux