Hi,
we're getting segfaults in one of our applications (multithreaded) while accessing an array element somewhere in the middle of the array. Elements at the beginning and at the end are fine. The array in question occupies ~64kb on the stack.
Using pstat_getprocvm() and mprotect() I found out that there is a one-page "hole" in the middle of the pthread's stack, which is neither readable nor writeable.
The attached program is a reduced test case which spawns a thread allocating an 192kb character array on the stack. That should be fine since the default stack size is 256kb.
When compiled with "aCC +DD64 -mt -g -o stackhole stackhole.c" or "gcc -g -mlp64 -pthread -o stackhole stackhole.c" it crashes at char 61456 with the default stack size.
Setting PTHREAD_DEFAULT_STACK_SIZE moves the "crash point", e.g. PTHREAD_DEFAULT_STACK_SIZE=320000 crashes at 28688.
This make only half of a thread's stack usable and clearly looks like a bug to me. Is there a patch available?
Regards
/Michael