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

Problems with pthread_key_delete/ex18


I had previously disabled the usage of %fs as thread specific register
for x86-64 in linuxthreads and in that case everything worked fine.

After having fixed a few bugs in the kernel (%fs was destroyed), I
have enabled it again and now all tests pass with current CVS.
There's just one problem and I could need some help here.

ex18 just hangs after some time, if I attach gdb I get:
(gdb) bt
#0  0x2a9571d20d in *__GI___sigsuspend (set=0x0)
    at ../sysdeps/unix/sysv/linux/ia64/sigsuspend.c:43
#1  0x2a95560c58 in __pthread_wait_for_restart_signal (self=0x7fbfffe3a0)
    at pthread.c:1142
#2  0x2a9555e256 in __pthread_do_exit (retval=0x7fbfffe440, 
    currentframe=0x7fbfffe3a0 "") at restart.h:34
#3  0x2a9555e12c in pthread_exit () at join.c:28
#4  0x00400c0d in main () at Examples/ex18.c:116
#5  0x2a9570a57e in __libc_start_main (main=0x400ba0 <main>, argc=1, 
    ubp_av=0x7fbfffe5e0, init=0x400c10 <__libc_csu_init>, 
    fini=0x552abbd000 <_rtld_local>, rtld_fini=0x7fbfffe3a0, 
    stack_end=0x7fbfffe3a0) at ../sysdeps/generic/libc-start.c:152

And notice that self->p_lock is not set:
(gdb) p *saved_self->p_lock 
$5 = {__status = 0, __spinlock = 0}

It seems that a signal is lost.

We also noticed one thing:

pthread_key_delete_helper runs in the context of the thread manager
and does:
  if (!th->p_terminated) {
    /* pthread_exit() may try to free th->p_specific[idx1st] concurrently. */
    __pthread_lock(THREAD_GETMEM(th, p_lock), self);
    if (th->p_specific[idx1st] != NULL)
      th->p_specific[idx1st][idx2nd] = NULL;
    __pthread_unlock(THREAD_GETMEM(th, p_lock));

this code looks broken, all implementations using thread registers do
not use the first parameter, so the parameter th is ignored and the
thread manager itself is locked instead of the threads.

Shouldn't this be?
    __pthread_lock(th->p_lock, self);

This cheange didn't help us.

Any suggestions and help is welcome,
Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj at suse dot de
   private aj at arthur dot inka dot de
    http://www.suse.de/~aj


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