This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fixed size of thread stacks in the nptl pthread implementation


The memory allocated by libc for thread stacks in the kernel using an
mmap of a fixed size using the MAP_STACK flag (among others). There is
currently no way to identify these maps in proc/<pid>/maps since they
come up as anon maps. Also, these stacks are of a fixed size, which
looks like a limitation.

Is this limitation intentional? It looks like it could easily have
been overwritten by using MAP_GROWSDOWN flag in the mmap call. POSIX
defines the thread stacks as having a minimum size, but I could not
find anything about them being fixed.

I have written a patch for the kernel to mark maps created with
MAP_STACK with VM_STACK_FLAGS which includes the correct stack
permissions according to system settings as well as VM_GROWSDOWN or
VM_GROWSUP depending on the system:

The intention was to have the maps marked correctly in
/proc/<pid>/maps but it also works towards unifying the way thread
stacks and the main thread stack behave and look. Among other things,
the major difference for glibc would be that the stack can grow
automatically like the main thread. Is there any reason why this
should not be implemented or would break things for glibc?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]