Bug 3102 - Threaded programs can't use chroot at startup, due to nptl's use of dlopen
Summary: Threaded programs can't use chroot at startup, due to nptl's use of dlopen
Status: RESOLVED INVALID
Alias: None
Product: glibc
Classification: Unclassified
Component: nptl (show other bugs)
Version: 2.3.2
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-22 15:51 UTC by Niels Möller
Modified: 2016-05-17 18:11 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Niels Möller 2006-08-22 15:51:26 UTC
When calling pthread_exit in a program which has called chroot, the
program exits with the error message

  libgcc_s.so.1 must be installed for pthread_cancel to work

The problem is that the nptl library needs the stack unwind code from
libgcc_s.so.1, and it uses dlopen to load this library.

I tried to install arlad, configured to use posix threads. This
program chroots to /usr/arla/cache at startup, before doing any
interesting thread operations.

Then the later dlopen by the nptl code naturally fails, and it
displays the above error message and calls _exit.

I'm not terribly familiar with the POSIX standard or with POSIX
threads, but it seems unintuitive and probably not standards compliant
that a threaded server program can't use chroot at startup.

A workaround seems to be to link the program with an explicit -lgcc_s
on the command line, in addition to -lpthread, but as far as I
understand, one should never need to link explicitly with libgcc_s.

I'm running linux-2.4.17.4 on a debian x86 box.

(I reported this bug on the debian glibc package a while ago,
http://bugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=360933, but I
haven't seen any progress there and I don't think the problem is debian specific
in any way).
Comment 1 Ulrich Drepper 2006-08-22 17:08:51 UTC
Many parts of a program are dynamically linked, not just libgcc_s.  iconv
modules, nss modules, libcidn, ...  It your responsibility to copy everything
you need into the chroot.