You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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:
@@ -82,6 +82,21 @@ int create_user_ns(struct cred *new)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int unshare_userns(unsigned long unshare_flags, struct cred **new_cred)
|
||||
{
|
||||
struct cred *cred;
|
||||
|
||||
if (!(unshare_flags & CLONE_NEWUSER))
|
||||
return 0;
|
||||
|
||||
cred = prepare_creds();
|
||||
if (!cred)
|
||||
return -ENOMEM;
|
||||
|
||||
*new_cred = cred;
|
||||
return create_user_ns(cred);
|
||||
}
|
||||
|
||||
void free_user_ns(struct kref *kref)
|
||||
{
|
||||
struct user_namespace *parent, *ns =
|
||||
|
||||
Reference in New Issue
Block a user