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: <6599ad830811211036k419ff716h6068d532c9942d73@mail.gmail.com>
Date:	Fri, 21 Nov 2008 10:36:37 -0800
From:	Paul Menage <menage@...gle.com>
To:	Lai Jiangshan <laijs@...fujitsu.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Linux Containers <containers@...ts.linux-foundation.org>
Subject: Re: [PATCH] cpuset: rcu_read_lock() to protect task_cs()

On Fri, Nov 21, 2008 at 12:49 AM, Lai Jiangshan <laijs@...fujitsu.com> wrote:
>
> task_cs() calls cgroup_subsys_state().

You mean it calls task_subsys_state().

>
> we must use rcu_read_lock() to protect cgroup_subsys_state().
>
> it's correct that top_cpuset is never freed, but cgroup_subsys_state()
> accesses css_set, this css_set maybe freed when task_cs() called.

It would be nice to have an RCU debug mode where rcu_dereference()
does a WARN() if it's invoked not under rcu_read_lock().

>
> we use use rcu_read_lock() to protect it.
>
> Signed-off-by: Lai Jiangshan <laijs@...fujitsu.com>
> ---
> diff --git a/kernel/cpuset.c b/kernel/cpuset.c
> index 3e00526..e0e087e 100644
> --- a/kernel/cpuset.c
> +++ b/kernel/cpuset.c
> @@ -363,14 +363,9 @@ void cpuset_update_task_memory_state(void)
>        struct task_struct *tsk = current;
>        struct cpuset *cs;
>
> -       if (task_cs(tsk) == &top_cpuset) {
> -               /* Don't need rcu for top_cpuset.  It's never freed. */
> -               my_cpusets_mem_gen = top_cpuset.mems_generation;
> -       } else {
> -               rcu_read_lock();
> -               my_cpusets_mem_gen = task_cs(tsk)->mems_generation;
> -               rcu_read_unlock();
> -       }
> +       rcu_read_lock();
> +       my_cpusets_mem_gen = task_cs(tsk)->mems_generation;
> +       rcu_read_unlock();

Yes, I guess this old cpusets assumption is no longer valid in cgroups.

Acked-by: Paul Menage <menage@...gle.com>

Thanks

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