Просмотр исходного кода

nptl: fix getting main stack size on no-MMU

On no-MMU, the main thread stack size doesn't depend on RLIMIT_STACK and
instead the stack size is simply the size of the mapping containing
__libc_stack_end.

Signed-off-by: Ben Wolsieffer <ben.wolsieffer@hefring.com>
Ben Wolsieffer 6 дней назад
Родитель
Сommit
1458f5cdac
1 измененных файлов с 6 добавлено и 0 удалено
  1. 6 0
      libpthread/nptl/pthread_getattr_np.c

+ 6 - 0
libpthread/nptl/pthread_getattr_np.c

@@ -107,7 +107,13 @@ pthread_getattr_np (
 		      && (uintptr_t) __libc_stack_end < to)
 		      && (uintptr_t) __libc_stack_end < to)
 		    {
 		    {
 		      /* Found the entry.  Now we have the info we need.  */
 		      /* Found the entry.  Now we have the info we need.  */
+#ifdef __ARCH_USE_MMU__
 		      iattr->stacksize = rl.rlim_cur;
 		      iattr->stacksize = rl.rlim_cur;
+#else
+		      /* On no-MMU, RLIMIT_STACK is not used and the stack is a
+			 fixed contiguous allocation.  */
+		      iattr->stacksize = to - from;
+#endif
 		      iattr->stackaddr = (void *) to;
 		      iattr->stackaddr = (void *) to;
 
 
 		      /* The limit might be too high.  */
 		      /* The limit might be too high.  */