Re: more signal locking bugs?

From: Linus Torvalds (torvalds@transmeta.com)
Date: Sun Feb 16 2003 - 14:24:38 EST


On Sun, 16 Feb 2003, Martin J. Bligh wrote:
>
> task_lock nests *inside* tasklist_lock but ... :

Yeah, this is a problem with any signal, not just SAK.

In fact, in general it is always _wrong_ to nest a non-interrupt-safe
lock inside an interrupt-safe spinlock, because then you can never take
the non-interrupt-safe one on its own (because an interrupt may come in
and take the interrupt-safe lock, at which point that CPU has now
violated ordering).

And if you always nest the interrupt-unsafee one inside the interrupt-
safe one, you might as well not have the interrupt-unsafe one in the first
place, since the outer lock _always_ protects the code in question anyway.

Which implies that either
 - the task lock should be _outside_ the tasklist_lock
or
 - the task lock should be made interrupt-safe.

If we make the tasklock one interrupt-safe, that should fix the signal
issue, and we can use the tasklock to protect "task->signal" and
"task->sighand".

In short, everything really seems to be pointing that way: the current
task lock simply _is_ broken, and has apparently always been broken (but
the ABBA deadlock is just extremely rare in practice, since you have to
get an interrupt at just the right point on one CPU, while you have the AB
case on another).

                Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Feb 23 2003 - 22:00:15 EST