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] [day] [month] [year] [list]
Message-ID: <87r4jrv7mn.fsf@xmission.com>
Date:	Thu, 07 Mar 2013 02:14:56 -0800
From:	ebiederm@...ssion.com (Eric W. Biederman)
To:	Rakib Mullick <rakib.mullick@...il.com>
Cc:	linux-kernel@...r.kernel.org,
	Serge Hallyn <serge.hallyn@...onical.com>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] nsproxy: Fix ->nsproxy counting problem in copy_namespace.


Thanks applied.

This is an unpleasant accidental memory leak.

Eric


Rakib Mullick <rakib.mullick@...il.com> writes:

> From cd41495e25cf2641ffe9e01a40d3d221a46b08be Mon Sep 17 00:00:00 2001
> From: Rakib Mullick <rakib.mullick@...il.com>
> Date: Thu, 7 Mar 2013 14:52:20 +0600
> Subject: [PATCH] nsproxy: Fix ->nsproxy counting problem in copy_namespace.
>
> In copy_namespace(), get_nsproxy() (which increments nsproxy->count) is called before checking namespace related flags.
> Therefore, task's nsproxy->count could have improper value, which could lead to calling free_nsproxy unnecessarily. Also,
> incrementing nsproxy->count is an atomic operation (which is expensive than normal increment operation), so before
> doing it - it's better we make sure namespace related flags are set.
>
> Signed-off-by: Rakib Mullick <rakib.mullick@...il.com>
> ---
>  kernel/nsproxy.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
> index afc0456..de36209 100644
> --- a/kernel/nsproxy.c
> +++ b/kernel/nsproxy.c
> @@ -130,12 +130,12 @@ int copy_namespaces(unsigned long flags, struct task_struct *tsk)
>  	if (!old_ns)
>  		return 0;
>  
> -	get_nsproxy(old_ns);
> -
>  	if (!(flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC |
>  				CLONE_NEWPID | CLONE_NEWNET)))
>  		return 0;
>  
> +	get_nsproxy(old_ns);
> +
>  	if (!ns_capable(user_ns, CAP_SYS_ADMIN)) {
>  		err = -EPERM;
>  		goto out;
--
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