]> git.hungrycats.org Git - linux/commitdiff
Avoid racy optimization in signal sending.
authorLinus Torvalds <torvalds@home.osdl.org>
Tue, 11 Nov 2003 02:52:30 +0000 (18:52 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Tue, 11 Nov 2003 02:52:30 +0000 (18:52 -0800)
The bug is probably impossible to trigger on x86, due to its
fairly strong coherency model (the SMP-safe bitops end up being
memory barriers etc), but other architectures - notably ppc64 -
can apparently trigger a race whereby the signal sender doesn't
wake up the target because it doesn't notice that it has gone to
sleep.

The optimization also optimizes only what appears to be the
uncommon case, where the signal happens for an already-running
process.

kernel/signal.c

index 150062afd23310a0e56126048ea2189a5095b99a..e0675f1d5e9c28322b338eff4185e74af03f3dd4 100644 (file)
@@ -538,7 +538,6 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
 inline void signal_wake_up(struct task_struct *t, int resume)
 {
        unsigned int mask;
-       int woken;
 
        set_tsk_thread_flag(t, TIF_SIGPENDING);
 
@@ -552,10 +551,7 @@ inline void signal_wake_up(struct task_struct *t, int resume)
        mask = TASK_INTERRUPTIBLE;
        if (resume)
                mask |= TASK_STOPPED;
-       woken = 0;
-       if (t->state & mask)
-               woken = wake_up_state(t, mask);
-       if (!woken)
+       if (!wake_up_state(t, mask))
                kick_process(t);
 }