From c48f8a77965433875ec26d9244519686286410eb Mon Sep 17 00:00:00 2001 From: Andrew Burford Date: Fri, 13 May 2022 23:13:26 -0400 Subject: [PATCH] fix andrew-user-ns.patch to use i_user_ns --- bug-fixes/andrew-user-ns.patch | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/bug-fixes/andrew-user-ns.patch b/bug-fixes/andrew-user-ns.patch index e4fb4bf..df1370c 100644 --- a/bug-fixes/andrew-user-ns.patch +++ b/bug-fixes/andrew-user-ns.patch @@ -1,5 +1,5 @@ diff --git a/fs/wrapfs/inode.c b/fs/wrapfs/inode.c -index ab0aff1abbd9..7adc0e7c6a2d 100644 +index ab0aff1abbd9..1424cced8bfc 100644 --- a/fs/wrapfs/inode.c +++ b/fs/wrapfs/inode.c @@ -8,8 +8,8 @@ @@ -155,7 +155,7 @@ index ab0aff1abbd9..7adc0e7c6a2d 100644 if (err) goto out; -@@ -348,17 +365,30 @@ static const char *wrapfs_get_link(struct dentry *dentry, struct inode *inode, +@@ -348,17 +365,19 @@ static const char *wrapfs_get_link(struct dentry *dentry, struct inode *inode, return buf; } @@ -164,22 +164,11 @@ index ab0aff1abbd9..7adc0e7c6a2d 100644 + struct inode *inode, int mask) { struct inode *lower_inode; -+ struct dentry *dentry = NULL; -+ struct path lower_path; int err; -+ /* -+ * Grab the first dentry for this inode. All dentries should belong -+ * to the same vfsmount so it doesn't matter which one we use. -+ */ -+ hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) -+ break; -+ BUG_ON(!dentry); -+ wrapfs_get_lower_path(dentry, &lower_path); lower_inode = wrapfs_lower_inode(inode); - err = inode_permission(lower_inode, mask); -+ err = inode_permission(mnt_user_ns(lower_path.mnt), lower_inode, mask); -+ wrapfs_put_lower_path(dentry, &lower_path); ++ err = inode_permission(i_user_ns(lower_inode), lower_inode, mask); return err; } @@ -189,7 +178,7 @@ index ab0aff1abbd9..7adc0e7c6a2d 100644 { int err; struct dentry *lower_dentry; -@@ -368,17 +398,17 @@ static int wrapfs_setattr(struct dentry *dentry, struct iattr *ia) +@@ -368,17 +387,17 @@ static int wrapfs_setattr(struct dentry *dentry, struct iattr *ia) struct iattr lower_ia; inode = d_inode(dentry); @@ -210,7 +199,7 @@ index ab0aff1abbd9..7adc0e7c6a2d 100644 lower_dentry = lower_path.dentry; lower_inode = wrapfs_lower_inode(inode); -@@ -416,7 +446,8 @@ static int wrapfs_setattr(struct dentry *dentry, struct iattr *ia) +@@ -416,7 +435,8 @@ static int wrapfs_setattr(struct dentry *dentry, struct iattr *ia) * tries to open(), unlink(), then ftruncate() a file. */ inode_lock(d_inode(lower_dentry)); @@ -220,7 +209,7 @@ index ab0aff1abbd9..7adc0e7c6a2d 100644 NULL); inode_unlock(d_inode(lower_dentry)); if (err) -@@ -432,11 +463,11 @@ static int wrapfs_setattr(struct dentry *dentry, struct iattr *ia) +@@ -432,11 +452,11 @@ static int wrapfs_setattr(struct dentry *dentry, struct iattr *ia) out: wrapfs_put_lower_path(dentry, &lower_path); @@ -234,7 +223,7 @@ index ab0aff1abbd9..7adc0e7c6a2d 100644 u32 request_mask, unsigned int flags) { int err; -@@ -450,7 +481,7 @@ static int wrapfs_getattr(const struct path *path, struct kstat *stat, +@@ -450,7 +470,7 @@ static int wrapfs_getattr(const struct path *path, struct kstat *stat, goto out; fsstack_copy_attr_all(d_inode(dentry), d_inode(lower_path.dentry)); @@ -243,7 +232,7 @@ index ab0aff1abbd9..7adc0e7c6a2d 100644 stat->blocks = lower_stat.blocks; out: wrapfs_put_lower_path(dentry, &lower_path); -@@ -470,7 +501,8 @@ wrapfs_setxattr(struct dentry *dentry, struct inode *inode, const char *name, +@@ -470,7 +490,8 @@ wrapfs_setxattr(struct dentry *dentry, struct inode *inode, const char *name, err = -EOPNOTSUPP; goto out; } @@ -253,7 +242,7 @@ index ab0aff1abbd9..7adc0e7c6a2d 100644 if (err) goto out; fsstack_copy_attr_all(d_inode(dentry), -@@ -496,7 +528,8 @@ wrapfs_getxattr(struct dentry *dentry, struct inode *inode, +@@ -496,7 +517,8 @@ wrapfs_getxattr(struct dentry *dentry, struct inode *inode, err = -EOPNOTSUPP; goto out; } @@ -263,7 +252,7 @@ index ab0aff1abbd9..7adc0e7c6a2d 100644 if (err) goto out; fsstack_copy_attr_atime(d_inode(dentry), -@@ -544,7 +577,7 @@ wrapfs_removexattr(struct dentry *dentry, struct inode *inode, const char *name) +@@ -544,7 +566,7 @@ wrapfs_removexattr(struct dentry *dentry, struct inode *inode, const char *name) err = -EOPNOTSUPP; goto out; } @@ -272,7 +261,7 @@ index ab0aff1abbd9..7adc0e7c6a2d 100644 if (err) goto out; fsstack_copy_attr_all(d_inode(dentry), lower_inode); -@@ -592,6 +625,7 @@ static int wrapfs_xattr_get(const struct xattr_handler *handler, +@@ -592,6 +614,7 @@ static int wrapfs_xattr_get(const struct xattr_handler *handler, } static int wrapfs_xattr_set(const struct xattr_handler *handler, -- 2.34.1