Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200630145851.GD13001@voyager>
Date: Tue, 30 Jun 2020 16:58:51 +0200
From: Markus Wichmann <nullplan@....net>
To: musl@...ts.openwall.com
Subject: Re: Potential deadlock in pthread_kill()

On Tue, Jun 30, 2020 at 05:26:46AM -0400, Rich Felker wrote:
> On Mon, Jun 29, 2020 at 11:19:39PM -0700, Hydro Flask wrote:
> >
> > Just to be clear, this doesn't only occur when calling
> > pthread_kill() and using pthread_self() as the target, it can be any
> > target thread, as long as it's the same target thread is used in the
> > signal handler and in the synchronous context.
>
> How so? If the target is different, the rest of the pthread_kill,
> including the unlock, will proceed concurrently with the signal
> handler. However you may be able to construct mutual-signaling
> deadlock cases.
>

Thread A calls pthread_kill(thread_c, ...). Thread B calls
(concurrently) pthread_kill(thread_a, ...). Thread B's signal arrives
while thread A holds the killlock. Signal handler calls
pthread_kill(thread_c, ...).

No mutual signalling. Doesn't even need thread B to be calling
pthread_kill, could be an external signal that just happens to arrive at
that time and is taken by thread A by (bad) luck.

Ciao,
Markus

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.