From: Benjamin Peterson <benjamin@python.org>
To: musl@lists.openwall.com
Subject: value of thread-specific data immediately after initialization
Date: Thu, 13 Sep 2018 13:39:38 -0700 [thread overview]
Message-ID: <1536871178.1074978.1507360824.56778F86@webmail.messagingengine.com> (raw)
POSIX says that after the creation of a thread-specific key, its associated value should be NULL in all threads. musl may not uphold this requirement if a particular key is deleted and later resued.
Here's an example of the bug:
#include <pthread.h>
#include <stdio.h>
int main() {
pthread_key_t k;
pthread_key_create(&k, NULL);
printf("%p\n", pthread_getspecific(k));
pthread_setspecific(k, &k);
pthread_key_delete(k);
pthread_key_create(&k, NULL);
printf("%p\n", pthread_getspecific(k));
pthread_key_delete(k);
return 0;
}
Per POSIX, I would expect this testcase to output two NULLs. However, musl prints the address of the old data even after the second initialization:
$ musl-gcc -o test test.c
$ ./test
0
0x7fff2ba3d004
next reply other threads:[~2018-09-13 20:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-13 20:39 Benjamin Peterson [this message]
2018-09-17 20:54 ` Rich Felker
2018-09-18 3:18 ` 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=1536871178.1074978.1507360824.56778F86@webmail.messagingengine.com \
--to=benjamin@python.org \
--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).