[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug in linuxthreads ?
From: |
Michael O. Neary |
Subject: |
Bug in linuxthreads ? |
Date: |
Mon, 17 Jun 2002 14:35:24 -0700 |
Hi,
I was trying to pass a user-defined stack to pthread_create(), and it
didn't work. When I debugged the pthreads library, I stumbled upon the
following code in pthread.c:
int __pthread_create_2_0(pthread_t *thread, const pthread_attr_t *attr,
void * (*start_routine)(void *), void *arg)
{
/* The ATTR attribute is not really of type `pthread_attr_t *'. It
has
the old size and access to the new members might crash the program.
We convert the struct now. */
pthread_attr_t new_attr;
if (attr != NULL)
{
size_t ps = __getpagesize ();
memcpy (&new_attr, attr,
(size_t) &(((pthread_attr_t*)NULL)->__guardsize));
new_attr.__guardsize = ps;
new_attr.__stackaddr_set = 0;
new_attr.__stackaddr = NULL;
new_attr.__stacksize = STACK_SIZE - ps;
attr = &new_attr;
}
return __pthread_create_2_1 (thread, attr, start_routine, arg);
}
As far as I can tell, this method overwrites anything a user supplies as
stackaddr
and stacksize. This means that user defined stacks don't work - is this
a bug,
or is there a reason for it ?
I am using glibc 2.2.5 and linuxthreads 2.2.5.
Thanks
Mike
=======================================================================
Michael O. Neary email: address@hidden
Eternal Systems, Inc. phone: (805)696-9051x235
5290 Overpass Road C/D fax: (805)696-9083
Santa Barbara, CA 93111, U.S.A. http://www.eternal-systems.com
=======================================================================
- Bug in linuxthreads ?,
Michael O. Neary <=