|
|
Message-ID: <c6502d12-8092-3572-2827-1f7884402b8d@yandex-team.ru>
Date: Wed, 20 May 2020 15:31:46 +0300
From: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
To: musl@...ts.openwall.com
Subject: pthread shouldn't ignore errors from syscall futex()
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
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.