提交 e3211c12 编写于 作者: A Andy Lutomirski

userns: Check uid_map's opener's fsuid, not the current fsuid

Signed-off-by: NAndy Lutomirski <luto@amacapital.net>
上级 6708075f
......@@ -797,12 +797,12 @@ static bool new_idmap_permitted(const struct file *file,
u32 id = new_map->extent[0].lower_first;
if (cap_setid == CAP_SETUID) {
kuid_t uid = make_kuid(ns->parent, id);
if (uid_eq(uid, current_fsuid()))
if (uid_eq(uid, file->f_cred->fsuid))
return true;
}
else if (cap_setid == CAP_SETGID) {
kgid_t gid = make_kgid(ns->parent, id);
if (gid_eq(gid, current_fsgid()))
if (gid_eq(gid, file->f_cred->fsgid))
return true;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册