Re: trouble with NGPT + Linux 2.5.40 + glibc 2.2.93

"Dr. Uwe Girlich" <[email protected]>
Newsgroups gmane.linux.ngpt.devel
Message-ID <[email protected]>
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
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.