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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50A30E0F.7000408@huawei.com>
Date:	Wed, 14 Nov 2012 11:20:47 +0800
From:	Li Zefan <lizefan@...wei.com>
To:	Tejun Heo <tj@...nel.org>
CC:	<containers@...ts.linux-foundation.org>, <cgroups@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <mhocko@...e.cz>,
	<glommer@...allels.com>
Subject: Re: [PATCH 04/17] cgroup: create directory before linking while creating
 a new cgroup

On 2012/11/13 11:01, Tejun Heo wrote:
> While creating a new cgroup, cgroup_create() links the newly allocated
> cgroup into various places before trying to create its directory.
> Because cgroup life-cycle is tied to the vfs objects, this makes it
> impossible to use cgroup_rmdir() for rolling back creation - the
> removal logic depends on having full vfs objects.
> 
> This patch moves directory creation above linking and collect linking
> operations to one place.  This allows directory creation failure to
> share error exit path with css allocation failures and any failure
> sites afterwards (to be added later) can use cgroup_rmdir() logic to
> undo creation.
> 

> It also removes the need to check whether cgroup->dentry is %NULL in
> cgroup_path.  If a cgroup is visible, its dentry is guaranteed to be
> visible too.
> 

I'm afraid this isn't safe.

The cgroup is visible to a controller soon after ss->create(), and then
the controller might call cgroup_path() while cgrp->dentry is still NULL.

This can happen for cpu cgroup I think, and in fact the NULL check was
added for this reason IIRC.

> Note that this also makes the memory barriers around cgroup->dentry,
> which currently is misleadingly using RCU operations, unnecessary.
> This will be handled in the next patch.
> 
> While at it, locking BUG_ON() on i_mutex is converted to
> lockdep_assert_held().
> 
> Signed-off-by: Tejun Heo <tj@...nel.org>
> ---
>  kernel/cgroup.c | 32 +++++++++++++-------------------
>  1 file changed, 13 insertions(+), 19 deletions(-)

--
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