From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13260 Path: news.gmane.org!.POSTED!not-for-mail From: Benjamin Peterson Newsgroups: gmane.linux.lib.musl.general Subject: value of thread-specific data immediately after initialization Date: Thu, 13 Sep 2018 13:39:38 -0700 Message-ID: <1536871178.1074978.1507360824.56778F86@webmail.messagingengine.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1536871068 3745 195.159.176.226 (13 Sep 2018 20:37:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 13 Sep 2018 20:37:48 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-13276-gllmg-musl=m.gmane.org@lists.openwall.com Thu Sep 13 22:37:44 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1g0YMx-0000sO-Qt for gllmg-musl@m.gmane.org; Thu, 13 Sep 2018 22:37:43 +0200 Original-Received: (qmail 15435 invoked by uid 550); 13 Sep 2018 20:39:52 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 15394 invoked from network); 13 Sep 2018 20:39:52 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=python.org; s=200901; t=1536871180; bh=nFuGE2DYNAg5S/XbPnqAiFr/mJB2FT2wRz6UXLA5BUw=; h=From:To:Subject:Date:From; b=s/11jvMPDTFqklsI3GjIHAJmrBumQc0ceBSwh8Z3UNpJQNYKw4nA99p+RUVmhRm1u TTvCxsrDFDDWYOSAoM8EALe4ZHuxwGPHUGGdk0wSqoJwrdMMVqe7BIGOzc+Qevsev1 WDtj7ffkudYIOfBbASqq/y9gv/fMqfJncNMMt+3k= X-ME-Proxy: X-ME-Sender: X-Mailer: MessagingEngine.com Webmail Interface - ajax-e556cd15 Xref: news.gmane.org gmane.linux.lib.musl.general:13260 Archived-At: 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 #include 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