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]
Message-ID: <20170831010319.GB491396@devbig577.frc2.facebook.com>
Date:   Wed, 30 Aug 2017 18:03:19 -0700
From:   Tejun Heo <tj@...nel.org>
To:     Neeraj Upadhyay <neeraju@...eaurora.org>
Cc:     lizefan@...wei.com, mingo@...nel.org, longman@...hat.com,
        akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
        sramana@...eaurora.org, prsood@...eaurora.org
Subject: Re: [PATCH] cgroup: Fix potential race between cgroup_exit and
 migrate path

On Wed, Aug 30, 2017 at 05:55:45PM -0700, Tejun Heo wrote:
> Would something like the following fix the issue?  Thanks.
> 
> diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
> index df2e0f1..cd85ca0 100644
> --- a/kernel/cgroup/cgroup.c
> +++ b/kernel/cgroup/cgroup.c
> @@ -683,7 +683,7 @@ static void css_set_move_task(struct task_struct *task,
>  			if (it->task_pos == &task->cg_list)
>  				css_task_iter_advance(it);
>  
> -		list_del_init(&task->cg_list);
> +		list_del(&task->cg_list);
>  		if (!css_set_populated(from_cset))
>  			css_set_update_populated(from_cset, false);
>  	} else {

Oops, more like the following.

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index df2e0f1..6f34025 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -683,7 +683,7 @@ static void css_set_move_task(struct task_struct *task,
 			if (it->task_pos == &task->cg_list)
 				css_task_iter_advance(it);
 
-		list_del_init(&task->cg_list);
+		list_del(&task->cg_list);
 		if (!css_set_populated(from_cset))
 			css_set_update_populated(from_cset, false);
 	} else {
@@ -702,6 +702,8 @@ static void css_set_move_task(struct task_struct *task,
 		rcu_assign_pointer(task->cgroups, to_cset);
 		list_add_tail(&task->cg_list, use_mg_tasks ? &to_cset->mg_tasks :
 							     &to_cset->tasks);
+	} else {
+		INIT_LIST_HEAD(&task->cg_list);
 	}
 }
 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ