All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Paul Menage" <menage@google.com>
Cc: "Li Zefan" <lizf@cn.fujitsu.com>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Linux Containers" <containers@lists.linux-foundation.org>,
	"Balbir Singh" <balbir@linux.vnet.ibm.com>,
	"KAMEZAWA Hiroyuki" <kamezawa.hiroyu@jp.fujitsu.com>,
	"Paul Jackson" <pj@sgi.com>
Subject: Re: [PATCH] cgroup: fix a race condition in manipulating tsk->cg_list
Date: Wed, 16 Apr 2008 21:59:07 -0700	[thread overview]
Message-ID: <20080416215907.63d71409.akpm@linux-foundation.org> (raw)
In-Reply-To: <6599ad830804162117w14364b7cg20d3694ffdfeb867@mail.gmail.com>

On Wed, 16 Apr 2008 21:17:34 -0700 "Paul Menage" <menage@google.com> wrote:

> On Wed, Apr 16, 2008 at 9:11 PM, Andrew Morton
> <akpm@linux-foundation.org> wrote:
> >
> >  I don't fully understand the race.  Both paths hold css_set_lock.
> >
> >  Can you describe it in more detail please?
> 
> Task A starts exiting, passes the check for unlinking current->cg_list.

So cgroup_exit() sees !list_empty(tsk->cg_list)

And the list_del() sets tsk->cg_list to LIST_POISON[12], which still means
!list_empty().  Or we remove that debugging code and avoid writing to
tsk->cg_list, and it _still_ is !list_empty().

> Before it completely exits task B does the very first
> cgroup_iter_begin() call (via reading a cgroups tasks file) which
> links all tasks in to their css_set objects via tsk->cg_list.

But it won't link this task, because it's !list_empty().

> Then task A finishes exiting and is freed, but doesn't unlink from the cg_list.
> 
> >
> >  afacit the task at *p could set PF_EXITING immediately after this code has
> >  tested PF_EXITING and then the task at *p could proceed until we hit the
> >  same race (whatever that is).
> 
> The important fact there is that the task sets PF_EXITING *before* it
> checks whether it needs to unlink from current->cg_list.
> 
> Paul

  parent reply	other threads:[~2008-04-17  5:00 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-17  3:37 [PATCH] cgroup: fix a race condition in manipulating tsk->cg_list Li Zefan
     [not found] ` <4806C5EB.3040102-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2008-04-17  4:11   ` Andrew Morton
2008-04-17  4:11     ` Andrew Morton
2008-04-17  4:17     ` Paul Menage
     [not found]       ` <6599ad830804162117w14364b7cg20d3694ffdfeb867-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-04-17  4:59         ` Andrew Morton
2008-04-17  4:59       ` Andrew Morton [this message]
     [not found]         ` <20080416215907.63d71409.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2008-04-17  5:10           ` Li Zefan
2008-04-17  5:20           ` Paul Menage
2008-04-17  5:10         ` Li Zefan
     [not found]           ` <4806DBC9.3090607-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2008-04-17  5:16             ` Andrew Morton
2008-04-17  5:16           ` Andrew Morton
2008-04-17  5:20         ` Paul Menage
     [not found]     ` <20080416211144.a38f6fc0.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2008-04-17  4:17       ` Paul Menage
2008-04-17  4:18   ` Paul Menage
2008-04-17  4:18 ` Paul Menage
2008-04-17  4:28   ` Paul Menage
     [not found]   ` <6599ad830804162118g6b24d8ebq26b0d72133b0e19e-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-04-17  4:28     ` Paul Menage
2008-04-17  5:04     ` Li Zefan
2008-04-17  5:04   ` Li Zefan
2008-04-17  5:16     ` Andrew Morton
     [not found]       ` <20080416221655.c73d219f.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2008-04-17  5:24         ` Paul Menage
2008-04-17  5:24       ` Paul Menage
     [not found]         ` <6599ad830804162224s42ba221vea981fe34b30636a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-04-17  5:27           ` Li Zefan
2008-04-17  5:27         ` Li Zefan
     [not found]     ` <4806DA6F.3000405-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2008-04-17  5:16       ` Andrew Morton
  -- strict thread matches above, loose matches on Subject: below --
2008-04-17  3:37 Li Zefan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080416215907.63d71409.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=menage@google.com \
    --cc=pj@sgi.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.