Branch: Tag:

1999-04-30

1999-04-30 07:22:19 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

stack overflows should now be detected properly on linux-glibc

Rev: src/Makefile.in:1.138
Rev: src/acconfig.h:1.41
Rev: src/configure.in:1.280
Rev: src/main.c:1.71

5:   \*/   /**/   #include "global.h" - RCSID("$Id: main.c,v 1.70 1999/04/12 02:24:15 hubbe Exp $"); + RCSID("$Id: main.c,v 1.71 1999/04/30 07:22:19 hubbe Exp $");   #include "fdlib.h"   #include "backend.h"   #include "module.h"
372: Inside #if defined(HAVE_GETRLIMIT) && defined(RLIMIT_STACK) and #if defined(RLIM_INFINITY)
   {   #ifdef RLIM_INFINITY    if(lim.rlim_cur == RLIM_INFINITY) -  lim.rlim_cur=1024*1024*128; +  lim.rlim_cur=1024*1024*32;   #endif -  stack_top += STACK_DIRECTION * (lim.rlim_cur - 8192 * sizeof(char *)); +  stack_top += STACK_DIRECTION * lim.rlim_cur;    -  + #ifdef HAVE_PTHREAD_INITIAL_THREAD_BOS +  { +  extern char * __pthread_initial_thread_bos; +  /* Linux glibc threads are limited to a 4 Mb stack +  * __pthread_initial_thread_bos is the actual limit +  */ +  +  if(__pthread_initial_thread_bos && +  (__pthread_initial_thread_bos - stack_top) *STACK_DIRECTION < 0) +  stack_top=__pthread_initial_thread_bos; +  } + #endif +  stack_top -= STACK_DIRECTION * 8192 * sizeof(char *); +    #ifdef STACK_DEBUG    fprintf(stderr, "1: C-stack: 0x%08p - 0x%08p, direction:%d\n",    &argv, stack_top, STACK_DIRECTION);