提交 aa71c61c 编写于 作者: E Eric W. Biederman 提交者: Zheng Zengkai

Revert 95ebabde ("capabilities: Don't allow writing ambiguous v3 file capabilities")

commit 3b0c2d3e 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: 95ebabde ("capabilities: Don't allow writing ambiguous v3 file capabilities")
Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 5c6864de
...@@ -506,8 +506,7 @@ int cap_convert_nscap(struct dentry *dentry, void **ivalue, size_t size) ...@@ -506,8 +506,7 @@ int cap_convert_nscap(struct dentry *dentry, void **ivalue, size_t size)
__u32 magic, nsmagic; __u32 magic, nsmagic;
struct inode *inode = d_backing_inode(dentry); struct inode *inode = d_backing_inode(dentry);
struct user_namespace *task_ns = current_user_ns(), struct user_namespace *task_ns = current_user_ns(),
*fs_ns = inode->i_sb->s_user_ns, *fs_ns = inode->i_sb->s_user_ns;
*ancestor;
kuid_t rootid; kuid_t rootid;
size_t newsize; size_t newsize;
...@@ -530,15 +529,6 @@ int cap_convert_nscap(struct dentry *dentry, void **ivalue, size_t size) ...@@ -530,15 +529,6 @@ int cap_convert_nscap(struct dentry *dentry, void **ivalue, size_t size)
if (nsrootid == -1) if (nsrootid == -1)
return -EINVAL; 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); newsize = sizeof(struct vfs_ns_cap_data);
nscap = kmalloc(newsize, GFP_ATOMIC); nscap = kmalloc(newsize, GFP_ATOMIC);
if (!nscap) if (!nscap)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册