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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 15 Sep 2017 08:47:44 -0700
From:   Tejun Heo <tj@...nel.org>
To:     Waiman Long <longman@...hat.com>
Cc:     Li Zefan <lizefan@...wei.com>, cgroups@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cgroup: Properly init nr_tasks in cgroup_taskset

Hello, Waiman.

On Thu, Sep 14, 2017 at 01:45:13PM -0700, Waiman Long wrote:
> Commit 610467270fb3 ("cgroup: don't call migration methods if there
> are no tasks to migrate") introduces a new field nr_tasks to the
> cgroup_taskset structure for keeping track of the number of tasks
> contained in the structure.  The initial value of this field, however,
> is not guaranteed to be 0 as all the cgroup_taskset structures are
> allocated from stack.  Therefore, we need to explicitly initilized
> it in the CGROUP_TASKSET_INIT() macro for the new code to behave
> correctly.
> 
> Signed-off-by: Waiman Long <longman@...hat.com>
> ---
>  kernel/cgroup/cgroup-internal.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h
> index 5151ff2..6b4c04e 100644
> --- a/kernel/cgroup/cgroup-internal.h
> +++ b/kernel/cgroup/cgroup-internal.h
> @@ -76,6 +76,7 @@ struct cgroup_mgctx {
>  	.src_csets		= LIST_HEAD_INIT(tset.src_csets),		\
>  	.dst_csets		= LIST_HEAD_INIT(tset.dst_csets),		\
>  	.csets			= &tset.src_csets,				\
> +	.nr_tasks		= 0,						\

But it's an initialization macro, which means that the only way these
are used is as a part of whole struct initialization and the compiler
would always set the unspecified fields to zero.

Thanks.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ