]> Git Repo - uclibc-ng.git/commitdiff
libpthread/nptl: create timer thread with sufficiant stack size (account for TLS)
authorPeter Seiderer <[email protected]>
Fri, 16 Apr 2021 21:12:51 +0000 (23:12 +0200)
committerWaldemar Brodkorb <[email protected]>
Sun, 18 Apr 2021 15:19:13 +0000 (17:19 +0200)
Create timer thread with sufficiant stack size (take into account
allocated space for thread-local-storage), for this backport glibc
commit 'Create internal threads with sufficient stack size' ([1],
[2]) introducing __pthread_get_minstack() and use it in
__start_helper_thread().

Fixes timer_create() in case of linking with library using large
TLS area (e.g openblas, see [3]).

[1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=2c1094bd700e63a8d7f547b3f5495bedb55c0a08
[2] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=630f4cc3aa019ede55976ea561f1a7af2f068639
[3] http://lists.busybox.net/pipermail/buildroot/2021-April/308281.html

Signed-off-by: Peter Seiderer <[email protected]>
libpthread/nptl/init.c
libpthread/nptl/pthreadP.h
libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c

index 4959d5ed8fae5322b0e94489c029c7904f30a125..5d25ded7db992d70775bffd6ea2f3c565c3ab188 100644 (file)
@@ -337,3 +337,9 @@ __pthread_initialize_minimal_internal (void)
 }
 strong_alias (__pthread_initialize_minimal_internal,
              __pthread_initialize_minimal)
+
+size_t
+__pthread_get_minstack (const pthread_attr_t *attr)
+{
+  return __static_tls_size + PTHREAD_STACK_MIN;
+}
index 13205512aa289b219431d23db101209899d52272..c686a4ca529dce97a20013dd316e702f6afa7097 100644 (file)
@@ -377,6 +377,7 @@ weak_function;
 
 extern void __pthread_init_static_tls (struct link_map *) attribute_hidden;
 
+extern size_t __pthread_get_minstack (const pthread_attr_t *attr);
 
 /* Namespace save aliases.  */
 extern int __pthread_getschedparam (pthread_t thread_id, int *policy,
index 514913317f7ab47de7daa90f7edbdba2f35c6781..60f2a724cc1f76dab9b54b6029e8524e8b7d2a72 100644 (file)
@@ -164,7 +164,7 @@ __start_helper_thread (void)
      and should go away automatically when canceled.  */
   pthread_attr_t attr;
   (void) pthread_attr_init (&attr);
-  (void) pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
+  (void) pthread_attr_setstacksize (&attr, __pthread_get_minstack (&attr));
 
   /* Block all signals in the helper thread but SIGSETXID.  To do this
      thoroughly we temporarily have to block all signals here.  The
This page took 0.03226 seconds and 4 git commands to generate.