Hello! While making the webkit-gtk package, I have encountered an odd issue: Using the login.conf below and running the example code (mostly taken from WebKit, also in KDE) results in a segmentation fault (i386/4.99.72). After some looking it seems increasing the stack size to 8M makes it overlap with something else. So the area returned does not belong to the application, only a part of it. I am not aware of the details of how does and should it work, but this seems a bug to me. Please correct me if I'm wrong. ======= login.conf ======= default:\ :path=/usr/bin /bin /usr/sbin /sbin /usr/X11R6/bin /usr/pkg/bin /usr/pkg/sbin /usr/local/bin:\ :umask=022:\ :datasize-max=512M:\ :datasize-cur=256M:\ :maxproc-max=256:\ :maxproc-cur=128:\ :openfiles-cur=512:\ :stacksize-cur=8M:\ :memoryuse=256M: ======= test.c ======= #include <stdio.h> #include <pthread.h> int main() { static void* stackBase = 0; static size_t stackSize = 0; pthread_t thread = pthread_self(); char *p; pthread_attr_t sattr; pthread_attr_init(&sattr); pthread_attr_get_np(thread, &sattr); pthread_attr_getstack(&sattr, &stackBase, &stackSize); pthread_attr_destroy(&sattr); printf("stack base address: %x\n", stackBase); printf("stack size: %d\n", stackSize); printf("stack+size address: %x\n", (char *)(stackBase) + stackSize); p = (char *)(stackBase) + stackSize - 1; printf("lets read the top: %x\n", *p); return 0; } -- Adam
Attachment:
pgpZ1zUeUqLLc.pgp
Description: PGP signature