lkml.org 
[lkml]   [2011]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: + cgroups-more-safe-tasklist-locking-in-cgroup_attach_proc.patch added to -mm tree
    > From: Ben Blum <bblum@andrew.cmu.edu>
    >
    > Fix unstable tasklist locking in cgroup_attach_proc.
    >
    > According to this thread - https://lkml.org/lkml/2011/7/27/243 - RCU is
    > not sufficient to guarantee the tasklist is stable w.r.t. de_thread and
    > exit. Taking tasklist_lock for reading, instead of rcu_read_lock, ensures
    > proper exclusion.

    I still think we should avoid the global lock.

    In any case, with tasklist or siglock,

    > - rcu_read_lock();
    > + read_lock(&tasklist_lock);
    > if (!thread_group_leader(leader)) {
    > /*
    > * a race with de_thread from another thread's exec() may strip
    > @@ -2036,7 +2036,7 @@ int cgroup_attach_proc(struct cgroup *cg
    > * throw this task away and try again (from cgroup_procs_write);
    > * this is "double-double-toil-and-trouble-check locking".
    > */
    > - rcu_read_unlock();
    > + read_unlock(&tasklist_lock);
    > retval = -EAGAIN;

    this check+comment becomes completely pointless and imho very confusing.

    Oleg.



    \
     
     \ /
      Last update: 2011-09-02 14:43    [W:0.020 / U:30.744 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site