This is the mail archive of the
libc-hacker@cygnus.com
mailing list for the glibc project.
Re: Why __libc_internal_tsd_get/__libc_internal_tsd_set
- To: Roland McGrath <roland@frob.com>
- Subject: Re: Why __libc_internal_tsd_get/__libc_internal_tsd_set
- From: Zack Weinberg <zack@rabi.columbia.edu>
- Date: Fri, 19 Mar 1999 14:45:48 -0500
- cc: hjl@varesearch.com (H.J. Lu), wmglo@dent.med.uni-muenchen.de (Wolfram Gloger), libc-hacker@cygnus.com (GNU C Library)
On Fri, 19 Mar 1999 14:13:19 -0500, Roland McGrath wrote:
>> It only works with static libraries. It doesn't work with shared
>> libraries. To work with shared libraries, weak symbols should be used
>> instead.
>
>You have not told us about any specific problem or given us any reason to
>believe there is in fact a problem. If you want anyone to do anything
>about the bugs you claim to find, then you have to show us the bugs.
I suspect based on context that this has to do with the appended program,
which is reported to segfault inside malloc on 2.0. I would test it on 2.1
but my machine is dead right now.
I have no idea why HJ thinks the fix is to muck around with the symbol
table. It looks to me like a locking bug.
zw
-----------------------------------------
#include <pthread.h>
#include <stdio.h>
pthread_key_t key;
void* main_thr(void* v)
{
void *a, *b, *c, *d, *e, *f;
pthread_setspecific(key, "asd");
a=malloc(4);
b=malloc(36);
c=malloc(20);
d=malloc(20);
e=malloc(24);
f=malloc(24);
free(f);
f=malloc(4440);
free(malloc(4440));
free(a);free(b);free(c);
pthread_setspecific(key, NULL);
}
int main()
{
pthread_t t_id;
pthread_key_create(&key, NULL);
pthread_create(&t_id, NULL, main_thr,(void*)0);
pthread_join(t_id, NULL);
/* sleep(1);*/
pthread_key_delete(key);
free(malloc(1));
return 0;
}
/* The program ends with SIGSEGV in the last malloc.
But when sleep(1) is uncommented it runs successfully.
Presumably there is some sort of race. */