• Paul Jackson's avatar
    [PATCH] cpuset: fix obscure attach_task vs exiting race · 181b6480
    Paul Jackson authored
    Fix obscure race condition in kernel/cpuset.c attach_task() code.
    
    There is basically zero chance of anyone accidentally being harmed by this
    race.
    
    It requires a special 'micro-stress' load and a special timing loop hacks
    in the kernel to hit in less than an hour, and even then you'd have to hit
    it hundreds or thousands of times, followed by some unusual and senseless
    cpuset configuration requests, including removing the top cpuset, to cause
    any visibly harm affects.
    
    One could, with perhaps a few days or weeks of such effort, get the
    reference count on the top cpuset below zero, and manage to crash the
    kernel by asking to remove the top cpuset.
    
    I found it by code inspection.
    
    The race was introduced when 'the_top_cpuset_hack' was introduced, and one
    piece of code was not updated.  An old check for a possibly null task
    cpuset pointer needed to be changed to a check for a task marked
    PF_EXITING.  The pointer can't be null anymore, thanks to
    the_top_...
    181b6480
cpuset.c 76 KB