[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20230130103149.7d09e239@canb.auug.org.au>
Date: Mon, 30 Jan 2023 10:31:49 +1100
From: Stephen Rothwell <sfr@...b.auug.org.au>
To: Christian Brauner <christian@...uner.io>,
Seth Forshee <sforshee@...nel.org>
Cc: Christian Brauner <brauner@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Next Mailing List <linux-next@...r.kernel.org>
Subject: linux-next: manual merge of the vfs-idmapping tree with Linus' tree
Hi all,
Today's linux-next merge of the vfs-idmapping tree got conflicts in:
fs/fuse/acl.c
fs/fuse/fuse_i.h
fs/fuse/xattr.c
between commit:
facd61053cff ("fuse: fixes after adapting to new posix acl api")
from Linus' tree and various commits from the vfs-idmapping tree.
Christian: thanks for supplying the resolution.
I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.
--
Cheers,
Stephen Rothwell
diff --cc fs/fuse/acl.c
index ad670369955f,23d1c263891f..000000000000
--- a/fs/fuse/acl.c
+++ b/fs/fuse/acl.c
@@@ -11,10 -11,9 +11,10 @@@
#include <linux/posix_acl.h>
#include <linux/posix_acl_xattr.h>
-struct posix_acl *fuse_get_acl(struct inode *inode, int type, bool rcu)
+static struct posix_acl *__fuse_get_acl(struct fuse_conn *fc,
- struct user_namespace *mnt_userns,
++ struct mnt_idmap *idmap,
+ struct inode *inode, int type, bool rcu)
{
- struct fuse_conn *fc = get_fuse_conn(inode);
int size;
const char *name;
void *value = NULL;
@@@ -54,47 -53,7 +54,47 @@@
return acl;
}
+static inline bool fuse_no_acl(const struct fuse_conn *fc,
+ const struct inode *inode)
+{
+ /*
+ * Refuse interacting with POSIX ACLs for daemons that
+ * don't support FUSE_POSIX_ACL and are not mounted on
+ * the host to retain backwards compatibility.
+ */
+ return !fc->posix_acl && (i_user_ns(inode) != &init_user_ns);
+}
+
- struct posix_acl *fuse_get_acl(struct user_namespace *mnt_userns,
++struct posix_acl *fuse_get_acl(struct mnt_idmap *idmap,
+ struct dentry *dentry, int type)
+{
+ struct inode *inode = d_inode(dentry);
+ struct fuse_conn *fc = get_fuse_conn(inode);
+
+ if (fuse_no_acl(fc, inode))
+ return ERR_PTR(-EOPNOTSUPP);
+
- return __fuse_get_acl(fc, mnt_userns, inode, type, false);
++ return __fuse_get_acl(fc, idmap, inode, type, false);
+}
+
+struct posix_acl *fuse_get_inode_acl(struct inode *inode, int type, bool rcu)
+{
+ struct fuse_conn *fc = get_fuse_conn(inode);
+
+ /*
+ * FUSE daemons before FUSE_POSIX_ACL was introduced could get and set
+ * POSIX ACLs without them being used for permission checking by the
+ * vfs. Retain that behavior for backwards compatibility as there are
+ * filesystems that do all permission checking for acls in the daemon
+ * and not in the kernel.
+ */
+ if (!fc->posix_acl)
+ return NULL;
+
- return __fuse_get_acl(fc, &init_user_ns, inode, type, rcu);
++ return __fuse_get_acl(fc, &nop_mnt_idmap, inode, type, rcu);
+}
+
- int fuse_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
+ int fuse_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
struct posix_acl *acl, int type)
{
struct inode *inode = d_inode(dentry);
@@@ -140,14 -99,8 +140,14 @@@
return ret;
}
- if (!vfsgid_in_group_p(i_gid_into_vfsgid(&nop_mnt_idmap, inode)) &&
+ /*
+ * Fuse daemons without FUSE_POSIX_ACL never changed the passed
+ * through POSIX ACLs. Such daemons don't expect setgid bits to
+ * be stripped.
+ */
+ if (fc->posix_acl &&
- !vfsgid_in_group_p(i_gid_into_vfsgid(&init_user_ns, inode)) &&
- !capable_wrt_inode_uidgid(&init_user_ns, inode, CAP_FSETID))
++ !vfsgid_in_group_p(i_gid_into_vfsgid(&nop_mnt_idmap, inode)) &&
+ !capable_wrt_inode_uidgid(&nop_mnt_idmap, inode, CAP_FSETID))
extra_flags |= FUSE_SETXATTR_ACL_KILL_SGID;
ret = fuse_setxattr(inode, name, value, size, 0, extra_flags);
diff --cc fs/fuse/fuse_i.h
index 46797a171a84,ee084cead402..000000000000
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@@ -1264,12 -1264,12 +1264,12 @@@ ssize_t fuse_getxattr(struct inode *ino
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, bool rcu);
+struct posix_acl *fuse_get_inode_acl(struct inode *inode, int type, bool rcu);
- struct posix_acl *fuse_get_acl(struct user_namespace *mnt_userns,
++struct posix_acl *fuse_get_acl(struct mnt_idmap *idmap,
+ struct dentry *dentry, int type);
- int fuse_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
+ int fuse_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
struct posix_acl *acl, int type);
/* readdir.c */
diff --cc fs/fuse/xattr.c
index 9fe571ab569e,30aaaa4b3bfb..000000000000
--- a/fs/fuse/xattr.c
+++ b/fs/fuse/xattr.c
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists