Skip to content

Commit 3b0c2d3

Browse files
committed
Revert 95ebabd ("capabilities: Don't allow writing ambiguous v3 file capabilities")
It turns out that there are in fact userspace implementations that care and this recent change caused a regression. containers/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>
1 parent a38fd87 commit 3b0c2d3

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
@@ -543,8 +543,7 @@ int cap_convert_nscap(struct user_namespace *mnt_userns, struct dentry *dentry,
543543
__u32 magic, nsmagic;
544544
struct inode *inode = d_backing_inode(dentry);
545545
struct user_namespace *task_ns = current_user_ns(),
546-
*fs_ns = inode->i_sb->s_user_ns,
547-
*ancestor;
546+
*fs_ns = inode->i_sb->s_user_ns;
548547
kuid_t rootid;
549548
size_t newsize;
550549

@@ -567,15 +566,6 @@ int cap_convert_nscap(struct user_namespace *mnt_userns, struct dentry *dentry,
567566
if (nsrootid == -1)
568567
return -EINVAL;
569568

570-
/*
571-
* Do not allow allow adding a v3 filesystem capability xattr
572-
* if the rootid field is ambiguous.
573-
*/
574-
for (ancestor = task_ns->parent; ancestor; ancestor = ancestor->parent) {
575-
if (from_kuid(ancestor, rootid) == 0)
576-
return -EINVAL;
577-
}
578-
579569
newsize = sizeof(struct vfs_ns_cap_data);
580570
nscap = kmalloc(newsize, GFP_ATOMIC);
581571
if (!nscap)

0 commit comments

Comments
 (0)