[parisc-linux] pthread attributes and stack positions (gcc related?)

Carlos O'Donell carlos@baldric.uwo.ca
Mon, 29 Sep 2003 11:10:38 -0400


On Sun, Sep 28, 2003 at 12:53:38PM -0500, James Bottomley wrote:
> On Sun, 2003-09-28 at 12:42, Carlos O'Donell wrote:
> > The variable is definately on the process stack. The thread's stack 
> > address seems to be inside the libraries 'writable' space and the stack 
> > size is wrong (or uninitialized). Perhaps I should just be looking for 
> > arch-dependant init code that we might be missing.
> 
> This, I believe to be correct: there's only one real stack (i.e. the
> thing on x86 that grows down from top of memory) and only one thread can
> have it.  The rest of the thread stacks are mmapped at fixed sizes with
> a guard area to prevent them growing too far.  mmapped memory comes out
> of the same pool that shared library memory comes from, so you should
> correctly see the mappings interleave (depending on the load and thread
> start order).

I agree, it seems though that after "fork" the values returned by 
"pthread_getattr_np (pthread_self (), &a);" are bogus. While if you call
pthread_create(...) and then the previous line from within the newly
created thread the values are initialized properly. A mistake might
exist with symbol versioning by which we are not calling libpthread's
overloaded thread manager "fork()" and continuing on with the normal syscall.

I think this seems to be a question of expected behaviour. I'll pass
this onto the libc-alpha list.

c.