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: <4913E72D.3060108@cn.fujitsu.com>
Date:	Fri, 07 Nov 2008 14:58:53 +0800
From:	Li Zefan <lizf@...fujitsu.com>
To:	Cedric Le Goater <clg@...ibm.com>
CC:	Paul Menage <menage@...gle.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Matt Helsley <matthltc@...ibm.com>,
	"Serge E. Hallyn" <serue@...ibm.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Linux Containers <containers@...ts.linux-foundation.org>
Subject: Re: [PATCH -last version] freezer_cg: disable writing freezer.state
 of root  cgroup

> I would make a small macro is_root_freezer() to show explicitly
> what we are testing and use the CSS_ROOT bit to test. That's what
> the CSS_ROOT bit is for Paul ?
> 

I think yes CSS_ROOT can be used, though currently CSS_ROOT is used in
cgroup internal only (in css_get() and css_put()).

> if yes, here's a possible result is below. 
> 

is_root_freezer() looks a bit better, but I don't have strong option about
this change, the original code and the comment is enough to explain what
we are doing.

> C.
> 
> Signed-off-by: Cedric Le Goater <clg@...ibm.com>
> ---
>  kernel/cgroup_freezer.c |   15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> Index: 2.6.27-lxc/kernel/cgroup_freezer.c
> ===================================================================
> --- 2.6.27-lxc.orig/kernel/cgroup_freezer.c
> +++ 2.6.27-lxc/kernel/cgroup_freezer.c
> @@ -47,6 +47,11 @@ static inline struct freezer *task_freez
>  			    struct freezer, css);
>  }
>  
> +static inline int is_root_freezer(struct freezer *freezer)
> +{
> +	return test_bit(CSS_ROOT, &freezer->css.flags);
> +}
> +
>  int cgroup_frozen(struct task_struct *task)
>  {
>  	struct freezer *freezer;
> @@ -190,6 +195,13 @@ static void freezer_fork(struct cgroup_s
>  	freezer = task_freezer(task);
>  	task_unlock(task);
>  
> +	/*
> +	 * The root cgroup is non-freezable, so we can skip the
> +	 * following check.
> +	 */
> +	if (is_root_freezer(freezer))
> +		return;
> +
>  	BUG_ON(freezer->state == CGROUP_FROZEN);
>  	spin_lock_irq(&freezer->lock);
>  	/* Locking avoids race with FREEZING -> THAWED transitions. */
> @@ -363,6 +375,9 @@ static struct cftype files[] = {
>  
>  static int freezer_populate(struct cgroup_subsys *ss, struct cgroup *cgroup)
>  {
> +	if (is_root_freezer(cgroup_freezer(cgroup)))
> +		return 0;
> +
>  	return cgroup_add_files(cgroup, ss, files, ARRAY_SIZE(files));
>  }
> 

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