[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#174270: libc6: debians i386 build of glibc incompatible with coroutines



Package: libc6
Version: 2.3.1-8
Severity: wishlist

The reason that I report this bug as a wishlist item is that it's
already solved in the upstream package, but it's not viable for debian
to use it, since the fix breaks compatibility with pre-2.4 kernels.

I report it to help others who might stumble over the problem, and to give
a solution. This item can be closed as soon as glibc is compiled with
MIN_KERNEL_SUPPORTED=2.4.

Summary:

Due to the way threading is implemented for kernels <2.4 on i386, glibc
becomes incompatible to any coroutine libraries (including the glibc
*ucontext famaily and sigaltstack etc., as soon as libpthread is linked
into a program. No actual use of threads is neccessary.

Details:

As soon is libpthread is loaded, glibc makes a lot of calls to pthread
functions. To access threadspecific data items (this is unrelated to the
TLS functionality of newer glibcs), the pthread functions look up the
stackpointer in it's internal list of thread stacks.

Functions like sigaltstack, setucontext or any coroutine library will
switch the stack, and the next (soon ;) call to a pthreads function (most
probably inside libc) will segfault. No workaorund is possible, since
libpthread needs to be changed.

This has been reported a long time ago to the upstream libc maintainers,
however, chances that this bug will get fixed are low, since it's both
speed-critical and only concerns kernels 2.2 and lower.

When compiled for kernel 2.4 (--kernal-version=2.4), the pthreads library
uses a more efficient method to locate it's storage which is independent
of stacks, thus the problem is nonexistent.

Solution for debian developers:

Recompile with debian glibc package with the environment variable
"MIN_KERNEL_SUPPORTED" set to "2.4".

-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux cerebro 2.4.20-ac2 #2 SMP Mon Dec 16 13:15:59 CET 2002 i686
Locale: LANG=C, LC_CTYPE=de_DE@euro

Versions of packages libc6 depends on:
ii  libdb1-compat                 2.1.3-7    The Berkeley database routines [gl

-- no debconf information




Reply to: