diff --git a/libc-top-half/musl/src/thread/pthread_create.c b/libc-top-half/musl/src/thread/pthread_create.c index 450fe15a..067104a4 100644 --- a/libc-top-half/musl/src/thread/pthread_create.c +++ b/libc-top-half/musl/src/thread/pthread_create.c @@ -458,6 +458,9 @@ int __pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict att if (!map) goto fail; #endif tsd = map + size - __pthread_tsd_size; +#ifndef __wasilibc_unmodified_upstream + memset(tsd, 0, __pthread_tsd_size); +#endif if (!stack) { #ifdef __wasilibc_unmodified_upstream stack = tsd - libc.tls_size;