Thread (7 messages) 7 messages, 4 authors, 2012-10-19

Re: Is not locking task_lock in cgroup_fork() safe?

From: Tejun Heo <hidden>
Date: 2012-10-18 20:07:12
Also in: lkml

Possibly related (same subject, not in this thread)

Hello, Frederic.

On Thu, Oct 18, 2012 at 04:50:59PM +0200, Frederic Weisbecker wrote:
Ah right I was confused. Hmm, indeed we have a race here on
cgroup_fork(). How about using css_try_get() in cgroup_fork() and
refetch the parent's css until we succeed? This requires rcu_read_lock
though, and freeing the css_set under RCU.

Don't know which is better.
For now, I'll revert the patches and cc stable.  Let's think about
improving it later.
Different problem but I really would like we sanitize the cgroup hooks
in fork. There is cgroup_fork(), cgroup_post_fork() which takes that
big css_set_lock, plus the big threadgroup lock... I hope we can
simplify the mess there.
Oh yeah, I've been looking at that one too.  There are a few problems
in that area.  I think all we need is clearing ->cgroups to NULL on
copy_process() and all the rest can be moved to cgroup_post_fork().
I'd also like to make it very explicit that migration can't happen
before post_fork is complete.
quoted
I really don't know.  Why isn't it locking the threadgroup to begin
with?
No idea, sounds like something to fix.
Alrighty.

Thanks.

-- 
tejun
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help