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]
Date:	Wed, 3 Dec 2008 12:54:40 +0900
From:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To:	Li Zefan <lizf@...fujitsu.com>
Cc:	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	"menage@...gle.com" <menage@...gle.com>,
	"balbir@...ux.vnet.ibm.com" <balbir@...ux.vnet.ibm.com>,
	"nishimura@....nes.nec.co.jp" <nishimura@....nes.nec.co.jp>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>
Subject: Re: [PATCH 1/3] cgroup: fix pre_destroy and semantics of
 css->refcnt

On Wed, 03 Dec 2008 11:44:36 +0800
Li Zefan <lizf@...fujitsu.com> wrote:

> > +/*
> > + * Try to set all subsys's refcnt to be 0.
> > + * css->refcnt==0 means this subsys will be destroy()'d.
> > + */
> > +static bool cgroup_set_subsys_removed(struct cgroup *cgrp)
> > +{
> > +	struct cgroup_subsys *ss;
> > +	struct cgroup_subsys_state *css, *tmp;
> > +
> > +	for_each_subsys(cgrp->root, ss) {
> > +		css = cgrp->subsys[ss->subsys_id];
> > +		if (!atomic_dec_and_test(&css->refcnt))
> > +			goto rollback;
> > +	}
> > +	return true;
> > +rollback:
> > +	for_each_subsys(cgrp->root, ss) {
> > +		tmp = cgrp->subsys[ss->subsys_id];
> > +		atomic_inc(&tmp->refcnt);
> > +		if (tmp == css)
> > +			break;
> > +	}
> > +	return false;
> > +}
> > +
> 
> This function may return false, then causes rmdir() fail. So css_tryget(subsys1)
> returns 0 doesn't necessarily mean subsys1->destroy() will be called,
> if subsys2's css's refcnt is >1 when cgroup_set_subsys_removed() is called.
> 
> Will this bring up bugs and problems?
> 

current user of css_get() is only memcg, so no problem now.

"css_tryget() fails" means "rmdir" is called against this cgroup. So, not so
troublesome in genral, I think. (the user will retry rmdir()).

To be honest, I don't want to return -EBUSY but wait for success in the kernel.
and go back to pre_destroy() for this temporal race.

Thanks,
-Kame





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