|
Message-ID: <D05988EE-5C2C-4893-ABA8-F35570CD83C7@amazon.com> Date: Tue, 11 Jul 2023 19:19:50 +0000 From: "Appelmans, Madeleine" <madelea@...zon.com> To: "musl@...ts.openwall.com" <musl@...ts.openwall.com> Subject: Difference in pthread behavior between glibc and musl Hello, There seems to be a difference in pthread behavior when compiling with glibc and using the musl-gcc wrapper. The attached snippet of code creates a destructor attribute which deletes a pthread key. The code never actually creates the pthread key. This code segfaults when compiled using musl-gcc, and does not segfault when compiled with gcc. Best guess at what is going on: When creating a pthread key, musl initializes a field called tsd<https://git.musl-libc.org/cgit/musl/tree/src/thread/pthread_key_create.c#n37>. When deleting a key, musl assumes that initialization has been done, and dereferences tsd without checking that it exists: see here<https://git.musl-libc.org/cgit/musl/tree/src/thread/pthread_key_create.c#n65>. This dereference may be the source of the segfault. Thanks, Madeleine Content of type "text/html" skipped Download attachment "pthread_test.c" of type "application/octet-stream" (217 bytes)
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.