Re: more signal locking bugs?

Linus Torvalds
2003-02-16T19:36:41Z

On Sun, 16 Feb 2003, Manfred Spraul wrote:
>
> ABBA is not a deadlock, because linux read_locks permit recursive calls.
>
> read_lock(tasklist_lock);
> task_lock(tsk);
> read_lock(tasklist_lock);
>
> Does not deadlock, nor any other ordering.
>
> The tasklist_lock is never taken for write from bh or irq context.

Doesn't matter.

CPU1 - do_exit() CPU2 - non-nested task_lock()

task_lock(tsk)
write_lock_irq(&tasklist_lock); IRQ HAPPENS
task_lock(tsk); read_lock(&tasklist_lock)

BOOM, you're dead.

See? ABBA _does_ happen with the task lock, it's just that the magic
required to do so is fairly unlikely thanks to the added requirement for
the irq to happen at just the right moment (ie there are no static
code-paths that can cause it).

Linus