From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
To: musl@lists.openwall.com
Subject: [musl] pthread shouldn't ignore errors from syscall futex()
Date: Wed, 20 May 2020 15:31:46 +0300 [thread overview]
Message-ID: <c6502d12-8092-3572-2827-1f7884402b8d@yandex-team.ru> (raw)
Userspace implementations of mutexes (including glibc) in some cases
retries operation without checking error code from syscall futex.
Example which loops inside second call rather than hung (or die) peacefully:
#include <stdlib.h>
#include <pthread.h>
int main(int argc, char **argv)
{
char buf[sizeof(pthread_mutex_t) + 1];
pthread_mutex_t *mutex = (pthread_mutex_t *)(buf + 1);
pthread_mutex_init(mutex, NULL);
pthread_mutex_lock(mutex);
pthread_mutex_lock(mutex);
}
Thread in lkml:
https://lore.kernel.org/lkml/158955700764.647498.18025770126733698386.stgit@buzz/T/
Related bug in glibc:
https://sourceware.org/bugzilla/show_bug.cgi?id=25997
next reply other threads:[~2020-05-20 12:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-20 12:31 Konstantin Khlebnikov [this message]
2020-05-20 16:05 ` Rich Felker
2020-05-20 17:38 ` Konstantin Khlebnikov
2020-05-20 17:49 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c6502d12-8092-3572-2827-1f7884402b8d@yandex-team.ru \
--to=khlebnikov@yandex-team.ru \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).