View Bug Activity | Format For Printing
I found a bug about the thread stack size overflow. Here are procedures to reproduce this bug: ------------------------------------------ [root@localhost Temp]# cat test.c #include <pthread.h> #include <stdio.h> int main(void) { size_t stacksize; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_getstacksize(&attr, &stacksize); printf("%lu\n", (unsigned long)stacksize); return 0; } ---------------------------------------------------- [root@localhost Temp]# gcc -o test test.c -lpthread [root@localhost Temp]# ulimit -s 1024 [root@localhost Temp]# ulimit -s 1024 [root@localhost Temp]# ./test 1048576 [root@localhost Temp]# ulimit -s $(( 0xffffffff / 1024 )) [root@localhost Temp]# ulimit -s 4194303 [root@localhost Temp]# ./test 0
Created an attachment (id=2133) patch to fix the bug
This is a user bug. I'm not going to add code to prevent the user from shooting herself/himself in the foot. Maybe sometimes it's useful. There is a clearly documented minimum stack size. If it is not followed bad things can happen. So, don't do it.