~ubuntu-branches/ubuntu/raring/linux-ti-omap4/raring-proposed

« back to all changes in this revision

Viewing changes to kernel/signal.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Ubuntu: 3.5.0-25.38
  • Date: 2013-02-20 22:03:31 UTC
  • mfrom: (74.1.1 quantal-proposed)
  • Revision ID: package-import@ubuntu.com-20130220220331-0ea4l33x3cr61nch
Tags: 3.5.0-220.28
* Release Tracking Bug
  - LP: #1130311

[ Paolo Pisati ]

* rebased on Ubuntu-3.5.0-25.38

[ Ubuntu: 3.5.0-25.38 ]

* Release Tracking Bug
  - LP: #1129472
* ptrace: introduce signal_wake_up_state() and ptrace_signal_wake_up()
  - LP: #1119885, #1129192
  - CVE-2013-0871
* ptrace: ensure arch_ptrace/ptrace_request can never race with SIGKILL
  - LP: #1119885, #1129192
  - CVE-2013-0871
* wake_up_process() should be never used to wakeup a TASK_STOPPED/TRACED
  task
  - LP: #1119885, #1129192
  - CVE-2013-0871

Show diffs side-by-side

added added

removed removed

Lines of Context:
678
678
 * No need to set need_resched since signal event passing
679
679
 * goes through ->blocked
680
680
 */
681
 
void signal_wake_up(struct task_struct *t, int resume)
 
681
void signal_wake_up_state(struct task_struct *t, unsigned int state)
682
682
{
683
 
        unsigned int mask;
684
 
 
685
683
        set_tsk_thread_flag(t, TIF_SIGPENDING);
686
 
 
687
684
        /*
688
 
         * For SIGKILL, we want to wake it up in the stopped/traced/killable
 
685
         * TASK_WAKEKILL also means wake it up in the stopped/traced/killable
689
686
         * case. We don't check t->state here because there is a race with it
690
687
         * executing another processor and just now entering stopped state.
691
688
         * By using wake_up_state, we ensure the process will wake up and
692
689
         * handle its death signal.
693
690
         */
694
 
        mask = TASK_INTERRUPTIBLE;
695
 
        if (resume)
696
 
                mask |= TASK_WAKEKILL;
697
 
        if (!wake_up_state(t, mask))
 
691
        if (!wake_up_state(t, state | TASK_INTERRUPTIBLE))
698
692
                kick_process(t);
699
693
}
700
694
 
842
836
        assert_spin_locked(&t->sighand->siglock);
843
837
 
844
838
        task_set_jobctl_pending(t, JOBCTL_TRAP_NOTIFY);
845
 
        signal_wake_up(t, t->jobctl & JOBCTL_LISTENING);
 
839
        ptrace_signal_wake_up(t, t->jobctl & JOBCTL_LISTENING);
846
840
}
847
841
 
848
842
/*
1797
1791
         * If SIGKILL was already sent before the caller unlocked
1798
1792
         * ->siglock we must see ->core_state != NULL. Otherwise it
1799
1793
         * is safe to enter schedule().
 
1794
         *
 
1795
         * This is almost outdated, a task with the pending SIGKILL can't
 
1796
         * block in TASK_TRACED. But PTRACE_EVENT_EXIT can be reported
 
1797
         * after SIGKILL was already dequeued.
1800
1798
         */
1801
1799
        if (unlikely(current->mm->core_state) &&
1802
1800
            unlikely(current->mm == current->parent->mm))
1922
1920
                if (gstop_done)
1923
1921
                        do_notify_parent_cldstop(current, false, why);
1924
1922
 
 
1923
                /* tasklist protects us from ptrace_freeze_traced() */
1925
1924
                __set_current_state(TASK_RUNNING);
1926
1925
                if (clear_code)
1927
1926
                        current->exit_code = 0;
3215
3214
        int old = current->blocked.sig[0];
3216
3215
        sigset_t newset;
3217
3216
 
 
3217
        siginitset(&newset, newmask);
3218
3218
        set_current_blocked(&newset);
3219
3219
 
3220
3220
        return old;