aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/user_namespace.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/user_namespace.c')
-rw-r--r--kernel/user_namespace.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index b99c862a2e3f..27c8dab48c07 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -843,6 +843,20 @@ static bool new_idmap_permitted(const struct file *file,
843 return false; 843 return false;
844} 844}
845 845
846bool userns_may_setgroups(const struct user_namespace *ns)
847{
848 bool allowed;
849
850 mutex_lock(&id_map_mutex);
851 /* It is not safe to use setgroups until a gid mapping in
852 * the user namespace has been established.
853 */
854 allowed = ns->gid_map.nr_extents != 0;
855 mutex_unlock(&id_map_mutex);
856
857 return allowed;
858}
859
846static void *userns_get(struct task_struct *task) 860static void *userns_get(struct task_struct *task)
847{ 861{
848 struct user_namespace *user_ns; 862 struct user_namespace *user_ns;