lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 4 Jan 2007 19:07:00 +0000
From:	Frederik Deweerdt <deweerdt@...e.fr>
To:	"Serge E. Hallyn" <serue@...ibm.com>
Cc:	Andrew Morton <akpm@...l.org>, lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -mm 8/8] user ns: implement user ns unshare

On Thu, Jan 04, 2007 at 12:13:10PM -0600, Serge E. Hallyn wrote:
> From: Serge E. Hallyn <serue@...ibm.com>
> Subject: [PATCH -mm 8/8] user ns: implement user ns unshare
> 
> Implement CLONE_NEWUSER flag useable at clone/unshare.
> 
> Signed-off-by: Serge E. Hallyn <serue@...ibm.com>
> ---
  
>  int copy_user_ns(int flags, struct task_struct *tsk)
>  {
> -	struct user_namespace *old_ns = tsk->nsproxy->user_ns;
> +	struct user_namespace *new_ns, *old_ns = tsk->nsproxy->user_ns;
>  	int err = 0;
        ^^^^^^^^^^^^
The "= 0" is superfluous here.
>  
>  	if (!old_ns)
>  		return 0;
>  
>  	get_user_ns(old_ns);
> -	return err;
> +	if (!(flags & CLONE_NEWUSER))
> +		return 0;
> +	err = -EPERM;
> +	if (!capable(CAP_SYS_ADMIN))
> +		goto out;
> +	err = -ENOMEM;
> +	new_ns = clone_user_ns(old_ns);
> +	if (!new_ns)
> +		goto out;
> +
> +	tsk->nsproxy->user_ns = new_ns;
> +	err = 0;
> +out:
> +	put_user_ns(old_ns);
> +	return 0;
        ^^^^^^^^^
Should be "return err;"

Regards,
Frederik
>  }
>  
>  void free_user_ns(struct kref *kref)
> -- 
> 1.4.1
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ