• Rafael J. Wysocki's avatar
    [PATCH] PM: Fix freezing of stopped tasks · 3df494a3
    Rafael J. Wysocki authored
    Currently, if a task is stopped (ie.  it's in the TASK_STOPPED state), it
    is considered by the freezer as unfreezeable.  However, there may be a race
    between the freezer and the delivery of the continuation signal to the task
    resulting in the task running after we have finished freezing the other
    tasks.  This, in turn, may lead to undesirable effects up to and including
    data corruption.
    
    To prevent this from happening we first need to make the freezer consider
    stopped tasks as freezeable.  For this purpose we need to make freezeable()
    stop returning 0 for these tasks and we need to force them to enter the
    refrigerator.  However, if there's no continuation signal in the meantime,
    the stopped tasks should remain stopped after all processes have been
    thawed, so we need to send an additional SIGSTOP to each of them before
    waking it up.
    
    Also, a stopped task that has just been woken up should first check if
    there's a freezing request for it and go to the refrigerator if that's the
    case.
    Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
    Acked-by: default avatarPavel Machek <pavel@ucw.cz>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    3df494a3
signal.c 67.3 KB