From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753725AbdIDNXb (ORCPT ); Mon, 4 Sep 2017 09:23:31 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:53426 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753557AbdIDNX3 (ORCPT ); Mon, 4 Sep 2017 09:23:29 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E2CCE60739 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=neeraju@codeaurora.org Subject: Re: [PATCH] cgroup: Fix potential race between cgroup_exit and migrate path To: Tejun Heo References: <1504097649-32754-1-git-send-email-neeraju@codeaurora.org> <20170831005545.GA491396@devbig577.frc2.facebook.com> <20170831010319.GB491396@devbig577.frc2.facebook.com> <20170831011230.GD491396@devbig577.frc2.facebook.com> Cc: lizefan@huawei.com, mingo@kernel.org, longman@redhat.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, sramana@codeaurora.org, prsood@codeaurora.org From: Neeraj Upadhyay Message-ID: Date: Mon, 4 Sep 2017 18:53:23 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20170831011230.GD491396@devbig577.frc2.facebook.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/31/2017 06:42 AM, Tejun Heo wrote: > On Wed, Aug 30, 2017 at 06:03:19PM -0700, Tejun Heo wrote: >> 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); >> } >> } > On the third thought, I don't think this can happen either because now > migration is strongly synchronized against exits. Please take a look > at the changes around cgroup_threadgroup_rwsem. > > Thanks. > Thank you for the suggestion; found below fix, which is not present in v4.4.86 stable code base. Please let me know in case I am missing something: eedd0f4 cgroupns: Close race between cgroup_post_fork and copy_cgroup_ns Thanks. -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation