Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Mon, 29 Jun 2020 21:19:08 -0700
From: Hydro Flask <hydroflask@...mail.com>
To: musl@...ts.openwall.com
Subject: Potential deadlock in pthread_kill()

Hello all,

Noticed something while reading some code today. pthread_kill() is 
specified by POSIX to be async signal safe but I noticed that in musl's 
implementation if a signal occurs while the "killlock" is held and the 
signal handler calls pthread_kill() on the same target thread, a 
deadlock will occur. Is this intentional?

         int pthread_kill(pthread_t t, int sig)
         {
                 int r;
                 LOCK(t->killlock);
                 r = t->tid ? -__syscall(SYS_tkill, t->tid, sig)
                         : (sig+0U >= _NSIG ? EINVAL : 0);
                 UNLOCK(t->killlock);
                 return r;
         }

Thank you for your attention.

Hydro

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.