Re: trouble with NGPT + Linux 2.5.40 + glibc 2.2.93

"Saurabh Desai" <[email protected]>
Newsgroups gmane.linux.ngpt.devel
Message-ID <[email protected]>

Thanks! Uwe for your findings. I also noticed this on RH8.0.

To fix this, I commented out the libc_internal_tsd_get and
libc_internal_tsd_set routines in pth_tcb.c (everything after line 350).
With that, the initial core dump problem is gone. However,
the program hangs at final exit() for maxnativethreads > 1.
Looks like the LDT part is not working properly with new Glibc
(NATIVE_SELF, etc), so I also commented out that in useldt.h
and use the pth_get_native_descr() directly, which fixes the exit()
problem.
I think we need to look at the glibc 2.3 changes closely and need
to make appropriate changes in NGPT to use new features like TLS, etc.

- - - - -
Saurabh Desai
POSIX Threading for Linux
IBM  Linux Technology Center
e-mail: [email protected] OR [email protected]
phone: 512-838-2655, T/L: 678-2655




"Dr. Uwe Girlich" <[email protected]>@www-124.ibm.com on 10/11/2002
04:05:53 AM

Sent by:    [email protected]


To:    pthreads-devel <[email protected]>
cc:
Subject:    Re: [pthreads-devel] trouble with NGPT + Linux 2.5.40 + glibc
       2.2.93


Hello!

I finally found the cause of the SEGFAULT on RedHat 8.0 during _init() of
NGPT,
which makes NGPT not usable at all under RedHat 8.0:

During our basic init process, we call sysconf() to get the number of
processors in the machine. Besides many other things, this does an sscanf
(),
which is a locale-dependent function. Locales are thread specific, so it
calls
        decimal = _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
which checks for __libc_internal_tsd_get. This variable is 0 in the
standard C
library but this weak symbol will be overwritten by our own NGPT
__libc_internal_tsd_get and it points now to libc_internal_tsd_get(), which
will be called. This function uses pth_get_current() and this finally has
no
idea on any current thread, because we are still in the basic init step. So
pth_get_current() returns 0 and libc_internal_tsd_get() returns NULL too
and
_NL_CURRENT() will access an invalid memory area.

We could simply correct this, if we set all entry points like
__libc_internal_tsd_get/libc_internal_tsd_get() to 0 and activate them
only after our basic initialisation. Or we could ignore the number of
processors for now and wait until the first pthread_create().

But also other functions like strtol() are locale dependent and should not
be used during init but NGPT uses this function to parse the environment
variables.

And BTW, the _init function of GLIBC was called already. At least this is
correct.

Bye, Uwe

--
Dr. Uwe Girlich              email: [email protected]
Philosys Software GmbH       www: www.philosys.de
Edisonstrasse 6              phone: +49 89 321407-44
D-85716 Unterschleissheim    fax: +49 89 321407-12

_______________________________________________
pthreads-devel mailing list
[email protected]
http://www-124.ibm.com/developerworks/oss/mailman/listinfo/pthreads-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.