userns: Implement unshare of the user namespace
- Add CLONE_THREAD to the unshare flags if CLONE_NEWUSER is selected As changing user namespaces is only valid if all there is only a single thread. - Restore the code to add CLONE_VM if CLONE_THREAD is selected and the code to addCLONE_SIGHAND if CLONE_VM is selected. Making the constraints in the code clear. Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
@@ -39,6 +39,7 @@ static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
|
||||
}
|
||||
|
||||
extern int create_user_ns(struct cred *new);
|
||||
extern int unshare_userns(unsigned long unshare_flags, struct cred **new_cred);
|
||||
extern void free_user_ns(struct kref *kref);
|
||||
|
||||
static inline void put_user_ns(struct user_namespace *ns)
|
||||
@@ -66,6 +67,14 @@ static inline int create_user_ns(struct cred *new)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline int unshare_userns(unsigned long unshare_flags,
|
||||
struct cred **new_cred)
|
||||
{
|
||||
if (unshare_flags & CLONE_NEWUSER)
|
||||
return -EINVAL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void put_user_ns(struct user_namespace *ns)
|
||||
{
|
||||
}
|
||||
|
Reference in New Issue
Block a user