Skip to content

Commit 5d5422a

Browse files
ebiedermgregkh
authored andcommitted
Revert 95ebabd ("capabilities: Don't allow writing ambiguous v3 file capabilities")
commit 3b0c2d3 upstream. It turns out that there are in fact userspace implementations that care and this recent change caused a regression. podman-container-tools/buildah#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: 95ebabd ("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>
1 parent 29bc89c commit 5d5422a

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

‎security/commoncap.c‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,7 @@ int cap_convert_nscap(struct dentry *dentry, void **ivalue, size_t size)
500500
__u32 magic, nsmagic;
501501
struct inode *inode = d_backing_inode(dentry);
502502
struct user_namespace *task_ns = current_user_ns(),
503-
*fs_ns = inode->i_sb->s_user_ns,
504-
*ancestor;
503+
*fs_ns = inode->i_sb->s_user_ns;
505504
kuid_t rootid;
506505
size_t newsize;
507506

@@ -524,15 +523,6 @@ int cap_convert_nscap(struct dentry *dentry, void **ivalue, size_t size)
524523
if (nsrootid == -1)
525524
return -EINVAL;
526525

527-
/*
528-
* Do not allow allow adding a v3 filesystem capability xattr
529-
* if the rootid field is ambiguous.
530-
*/
531-
for (ancestor = task_ns->parent; ancestor; ancestor = ancestor->parent) {
532-
if (from_kuid(ancestor, rootid) == 0)
533-
return -EINVAL;
534-
}
535-
536526
newsize = sizeof(struct vfs_ns_cap_data);
537527
nscap = kmalloc(newsize, GFP_ATOMIC);
538528
if (!nscap)

0 commit comments

Comments
 (0)