This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports 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]

Re: setting of initial bottom of stack variable in pthread.c (again)



> What I'm trying to say is that if you read the code
> that's there today,
> it tries to preserve alignment + 2 * STACK_SIZE for

> Oho!  OK, now we know what's going on.
> 
> We always adjust the rlimit down in the
> !FLOATING_STACKS case (the
> #if's make this a little hard to see).  So it's not
> shocking that
> large mallocs get "in that stack".
> 
> But it still shouldn't break.  It looks like you're
> letting the
> thread library allocate stacks, and it is
> deliberately trying
> to allocate one there:
> 
> [pid  2189] old_mmap(0xbfa00000, 2097152,
> PROT_READ|PROT_WRITE|PROT_EXEC,
> MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xbfa00000
> 
> But why is it doing that?  thread_segment should
> pick
> THREAD_STACK_START_ADDRESS, which should be
> determined by
> __pthread_initial_thread_bos.  Then here's the code
> which
> does the mmap:
> 
>       new_thread = default_new_thread;
>       new_thread_bottom = (char *) (new_thread + 1)
> - stacksize;
>       map_addr = new_thread_bottom - guardsize;
>       res_addr = mmap(map_addr, stacksize +
> guardsize,
>                       PROT_READ | PROT_WRITE |
> PROT_EXEC,
>                       MAP_PRIVATE | MAP_ANONYMOUS,
> -1, 0);
> 
> And that's supposed to map the thread at
> __pthread_initial_thread_bos
> minus STACK_SIZE.  Which is apparently not happening
> for you.  So
> what does it think it's mapping?

I put some printf's into the thread segment function. 
For some reason THREAD_STACK_START_ADDRESS = BFE00000
while __pthread_initial_thread_bos = BFA00000, so I
believe I need to figure out why these two are
different.  My first guess is going to be that
THREAD_STACK_START_ADDRESS is defined somewhere else
so it never gets set to __pthread_initial_thread_bos
as in internals.h

Thanks

Jay


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


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