summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2021-03-12 15:07:09 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-17 16:34:31 +0100
commitf95ea27037e279d51d1d515c4dd3bc59198eb88a (patch)
tree62a35d846dbb05be27fd7630ed6b3cfe3214d629 /security
parentf3a8be52784e8cf8ae2fd7ab07cd02d2f4fc176b (diff)
Revert 95ebabde382c ("capabilities: Don't allow writing ambiguous v3 file capabilities")
commit 3b0c2d3eaa83da259d7726192cf55a137769012f upstream. It turns out that there are in fact userspace implementations that care and this recent change caused a regression. https://github.com/containers/buildah/issues/3071 As the motivation for the original change was future development, and the impact is existing real world code just revert this change and allow the ambiguity in v3 file caps. Cc: stable@vger.kernel.org Fixes: 95ebabde382c ("capabilities: Don't allow writing ambiguous v3 file capabilities") Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'security')
-rw-r--r--security/commoncap.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/security/commoncap.c b/security/commoncap.c
index b534c4eee5be..bf689d61b293 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -507,8 +507,7 @@ int cap_convert_nscap(struct dentry *dentry, void **ivalue, size_t size)
__u32 magic, nsmagic;
struct inode *inode = d_backing_inode(dentry);
struct user_namespace *task_ns = current_user_ns(),
- *fs_ns = inode->i_sb->s_user_ns,
- *ancestor;
+ *fs_ns = inode->i_sb->s_user_ns;
kuid_t rootid;
size_t newsize;
@@ -531,15 +530,6 @@ int cap_convert_nscap(struct dentry *dentry, void **ivalue, size_t size)
if (nsrootid == -1)
return -EINVAL;
- /*
- * Do not allow allow adding a v3 filesystem capability xattr
- * if the rootid field is ambiguous.
- */
- for (ancestor = task_ns->parent; ancestor; ancestor = ancestor->parent) {
- if (from_kuid(ancestor, rootid) == 0)
- return -EINVAL;
- }
-
newsize = sizeof(struct vfs_ns_cap_data);
nscap = kmalloc(newsize, GFP_ATOMIC);
if (!nscap)