[Openmcl-devel] 0.14.2-p1 segfaults on gentoo linux.

Gary Byers gb at clozure.com
Tue Oct 19 17:50:42 PDT 2004


This came up a few months ago.  My dim recollection is that the problem
has something to do with the fact that the C library is configured to use
thread-local-storage and the threads library is an older (traditional)
linuxthreads version that needs to install glue code between application
signal handlers and the kernel (note that all of the rt_sigaction calls
in the trace below vector to the same place; the lisp kernel -thinks-
that it's establishing unique signal handlers.)

This can't work: thread-local storage depends on a register containing
a pointer to that thread-local storage whenever that storage is
accessed.  Lisp code doesn't use C's notion of TLS and uses that
register for another purpose; if an exception handler occurs, the lisp
kernel's exception handler is very careful to establish that register
value before making any library calls that may depend on it being set
up correctly. Unfortunately, the (old) linuxthreads library is doing
the "real" exception handling before lisp's kernel gets a chance to
run, and the linuxthreads library is assuming that the TLS register is
valid.  It isn't.

I think that other distributions either offer old, pre-TLS versions
of things or offer a newer threads library (NPTL) that assumes a
greater degree of kernel threads support and doesn't need to install
itself between the kernel and exception handlers.

There -may- be some libc configuration options that would enable the
selection of a saner combination of libraries.  The only other
approach that I can think of is for the lisp kernel to install
exception handlers without using the "sigaction" library routine to do
so (either to use the appropriate system call directly or to call
"libc_sigaction" -or whatever it's called - to ensure that it's not
using something patched by the old threads library.  I -think- that
the glue that the old linuxthreads library is providing is unnecessary
under 2.6 kernels (and may have been unnecessary for a long time.)

If there's some config file on Gentoo (I have a copy installed, but
it's installed on another partition of the laptop I'm using at the
moment) that allows selection of NPTL at runtime, that might be the
best choice.  The fact that GDB claims some difficulty in dealing
with shared libraries in this configuration is probably not directly
related, but makes me kind of suspicious of the whole Gentoo setup.

If you don't get anywhere by trying to juggle library configurations,
let me know and I'll try to boot into Gentoo and look at it.




More information about the Openmcl-devel mailing list