Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 346324
b: refs/heads/master
c: 37657da
h: refs/heads/master
v: v3
  • Loading branch information
Eric W. Biederman committed Nov 20, 2012
1 parent 6e2ef41 commit 0687330
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7fa294c8991ce0ed4e713f08209eb2ce3e1044ac
refs/heads/master: 37657da3c5d4a3bbbbb9d3b78f53a8134a0abae0
15 changes: 15 additions & 0 deletions trunk/kernel/user_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,21 @@ ssize_t proc_projid_map_write(struct file *file, const char __user *buf, size_t
static bool new_idmap_permitted(struct user_namespace *ns, int cap_setid,
struct uid_gid_map *new_map)
{
/* Allow mapping to your own filesystem ids */
if ((new_map->nr_extents == 1) && (new_map->extent[0].count == 1)) {
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()))
return true;
}
else if (cap_setid == CAP_SETGID) {
kgid_t gid = make_kgid(ns->parent, id);
if (gid_eq(gid, current_fsgid()))
return true;
}
}

/* Allow anyone to set a mapping that doesn't require privilege */
if (!cap_valid(cap_setid))
return true;
Expand Down

0 comments on commit 0687330

Please sign in to comment.