#650234 mismatch between system ld-linux.so and chroot libc.so breaks most pseudo-chroot environments

Package:
fakechroot
Source:
fakechroot
Submitter:
Daniel Kahn Gillmor
Date:
2021-10-23 06:57:02 UTC
Severity:
important
Tags:
#650234#5
Date:
2011-11-28 00:29:44 UTC
From:
To:
I invoked debootstrap as a non-privileged user from an up-to-date sid
system like this (trying to set up a squeeze chroot):

http_proxy=http://proxy:3128/ fakechroot fakeroot -s stable.fakeroot /usr/bin/env PATH=/usr/sbin:/usr/bin:/sbin:/bin /usr/sbin/debootstrap --keyring=/usr/share/keyrings/debian-archive-keyring.gpg --variant=fakechroot stable stable http://mirror.cc.columbia.edu/debian

But it terminated with a failure:


I: Installing core packages...
W: Failure trying to run: chroot /home/consoleuser/fakechroot/stable dpkg --force-depends --install /var/cache/apt/archives/base-files_6.0squeeze3_i386.deb /var/cache/apt/archives/base-passwd_3.5.22_i386.deb


deboostrap/debootstrap.log shows:

gpgv: WARNING: multiple signatures detected.  Only the first will be checked.
gpgv: Signature made Sat Oct  8 08:06:14 2011 EDT using RSA key ID 473041FA
gpgv: Good signature from "Debian Archive Automatic Signing Key (6.0/squeeze) <ftpmaster@debian.org>"
Segmentation fault


trying to do a minimal operation within the chroot for debugging, i get:

0 consoleuser@stylus:~/fakechroot$ fakechroot /usr/sbin/chroot $(pwd)/stable /bin/true
Segmentation fault
139 consoleuser@stylus:~/fakechroot$


here's strace output of the segfault:

0 consoleuser@stylus:~/fakechroot$ strace fakechroot /usr/sbin/chroot $(pwd)/stable /bin/true
execve("/usr/bin/fakechroot", ["fakechroot", "/usr/sbin/chroot", "/home/consoleuser/fakechroot/sta"..., "/bin/true"], [/* 20 vars */]) = 0
brk(0)                                  = 0x9307000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb78d7000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=89825, ...}) = 0
mmap2(NULL, 89825, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb78c1000
close(4)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/i386-linux-gnu/i686/cmov/libc.so.6", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\240o\1\0004\0\0\0"..., 512) = 512
fstat64(4, {st_mode=S_IFREG|0755, st_size=1401000, ...}) = 0
mmap2(NULL, 1415544, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb7767000
mprotect(0xb78ba000, 4096, PROT_NONE)   = 0
mmap2(0xb78bb000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x153) = 0xb78bb000
mmap2(0xb78be000, 10616, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb78be000
close(4)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7766000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb77668d0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0xb78bb000, 8192, PROT_READ)   = 0
mprotect(0xb78f5000, 4096, PROT_READ)   = 0
munmap(0xb78c1000, 89825)               = 0
getpid()                                = 31956
rt_sigaction(SIGCHLD, {0x80563f0, ~[RTMIN RT_1], 0}, NULL, 8) = 0
geteuid32()                             = 1000
brk(0)                                  = 0x9307000
brk(0x9328000)                          = 0x9328000
getppid()                               = 31955
stat64("/home/consoleuser/fakechroot", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat64(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/usr/bin/fakechroot", O_RDONLY)   = 4
fcntl64(4, F_DUPFD, 10)                 = 10
close(4)                                = 0
fcntl64(10, F_SETFD, FD_CLOEXEC)        = 0
rt_sigaction(SIGINT, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {0x80563f0, ~[RTMIN RT_1], 0}, NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL, ~[RTMIN RT_1], 0}, NULL, 8) = 0
rt_sigaction(SIGTERM, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTERM, {SIG_DFL, ~[RTMIN RT_1], 0}, NULL, 8) = 0
read(10, "#!/bin/sh\n\nusage () {\ncat - >&2 "..., 8192) = 1945
pipe([4, 5])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7766938) = 31957
close(5)                                = 0
read(4, "getopt from util-linux 2.20.1\n", 128) = 30
read(4, "", 128)                        = 0
close(4)                                = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 31957
--- SIGCHLD (Child exited) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
pipe([4, 5])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7766938) = 31958
close(5)                                = 0
read(4, " -- '/usr/sbin/chroot' '/home/co"..., 128) = 73
read(4, "", 128)                        = 0
close(4)                                = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 31958
--- SIGCHLD (Child exited) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
pipe([4, 5])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7766938) = 31959
close(5)                                = 0
read(4, "/usr/lib/i386-linux-gnu/fakechro"..., 128) = 35
read(4, "", 128)                        = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
close(4)                                = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 31959
pipe([4, 5])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7766938) = 31962
close(5)                                = 0
read(4, "/usr/lib/i386-linux-gnu/fakechro"..., 128) = 35
read(4, "", 128)                        = 0
close(4)                                = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 31962
--- SIGCHLD (Child exited) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
faccessat(AT_FDCWD, "/usr/lib/i386-linux-gnu/fakechroot/libfakechroot.so", R_OK) = 0
execve("/usr/sbin/chroot", ["/usr/sbin/chroot", "/home/consoleuser/fakechroot/sta"..., "/bin/true"], [/* 24 vars */]) = 0
brk(0)                                  = 0x903f000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7899000
open("/usr/lib/i386-linux-gnu/fakechroot/tls/i686/sse2/cmov/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/tls/i686/sse2/cmov", 0xbfbef3b0) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/tls/i686/sse2/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/tls/i686/sse2", 0xbfbef3b0) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/tls/i686/cmov/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/tls/i686/cmov", 0xbfbef3b0) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/tls/i686/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/tls/i686", 0xbfbef3b0) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/tls/sse2/cmov/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/tls/sse2/cmov", 0xbfbef3b0) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/tls/sse2/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/tls/sse2", 0xbfbef3b0) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/tls/cmov/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/tls/cmov", 0xbfbef3b0) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/tls/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/tls", 0xbfbef3b0) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/i686/sse2/cmov/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/i686/sse2/cmov", 0xbfbef3b0) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/i686/sse2/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/i686/sse2", 0xbfbef3b0) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/i686/cmov/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/i686/cmov", 0xbfbef3b0) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/i686/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/i686", 0xbfbef3b0) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/sse2/cmov/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/sse2/cmov", 0xbfbef3b0) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/sse2/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/sse2", 0xbfbef3b0) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/cmov/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/cmov", 0xbfbef3b0) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/libfakechroot.so", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\2000\0\0004\0\0\0"..., 512) = 512
fstat64(4, {st_mode=S_IFREG|0644, st_size=89056, ...}) = 0
mmap2(NULL, 92136, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb7882000
mmap2(0xb7897000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x14) = 0xb7897000
close(4)                                = 0
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=89825, ...}) = 0
mmap2(NULL, 89825, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb786c000
close(4)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/i386-linux-gnu/i686/cmov/libc.so.6", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\240o\1\0004\0\0\0"..., 512) = 512
fstat64(4, {st_mode=S_IFREG|0755, st_size=1401000, ...}) = 0
mmap2(NULL, 1415544, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb7712000
mprotect(0xb7865000, 4096, PROT_NONE)   = 0
mmap2(0xb7866000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x153) = 0xb7866000
mmap2(0xb7869000, 10616, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7869000
close(4)                                = 0
open("/usr/lib/i386-linux-gnu/fakechroot/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/i386-linux-gnu/i686/cmov/libdl.so.2", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`\n\0\0004\0\0\0"..., 512) = 512
fstat64(4, {st_mode=S_IFREG|0644, st_size=9844, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7711000
mmap2(NULL, 12408, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb770d000
mmap2(0xb770f000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x1) = 0xb770f000
close(4)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb770c000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb770c6c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0xb770f000, 4096, PROT_READ)   = 0
mprotect(0xb7866000, 8192, PROT_READ)   = 0
mprotect(0xb7897000, 4096, PROT_READ)   = 0
mprotect(0xb78b7000, 4096, PROT_READ)   = 0
munmap(0xb786c000, 89825)               = 0
getuid32()                              = 1000
brk(0)                                  = 0x903f000
brk(0x9060000)                          = 0x9060000
socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4
connect(4, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(4)                                = 0
socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4
connect(4, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(4)                                = 0
open("/etc/nsswitch.conf", O_RDONLY)    = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=513, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7881000
read(4, "# /etc/nsswitch.conf\n#\n# Example"..., 4096) = 513
read(4, "", 4096)                       = 0
close(4)                                = 0
munmap(0xb7881000, 4096)                = 0
open("/usr/lib/i386-linux-gnu/fakechroot/libnss_compat.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=89825, ...}) = 0
mmap2(NULL, 89825, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb786c000
close(4)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/i386-linux-gnu/i686/cmov/libnss_compat.so.2", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\340\r\0\0004\0\0\0"..., 512) = 512
fstat64(4, {st_mode=S_IFREG|0644, st_size=26456, ...}) = 0
mmap2(NULL, 29264, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb7704000
mmap2(0xb770a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x5) = 0xb770a000
close(4)                                = 0
open("/usr/lib/i386-linux-gnu/fakechroot/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/i386-linux-gnu/i686/cmov/libnsl.so.1", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0P1\0\0004\0\0\0"..., 512) = 512
fstat64(4, {st_mode=S_IFREG|0644, st_size=79728, ...}) = 0
mmap2(NULL, 92136, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb76ed000
mmap2(0xb7700000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x12) = 0xb7700000
mmap2(0xb7702000, 6120, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7702000
close(4)                                = 0
mprotect(0xb7700000, 4096, PROT_READ)   = 0
mprotect(0xb770a000, 4096, PROT_READ)   = 0
munmap(0xb786c000, 89825)               = 0
open("/usr/lib/i386-linux-gnu/fakechroot/libnss_nis.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=89825, ...}) = 0
mmap2(NULL, 89825, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb786c000
close(4)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/i386-linux-gnu/i686/cmov/libnss_nis.so.2", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0P\31\0\0004\0\0\0"..., 512) = 512
fstat64(4, {st_mode=S_IFREG|0644, st_size=38556, ...}) = 0
mmap2(NULL, 41532, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb76e2000
mmap2(0xb76eb000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x8) = 0xb76eb000
close(4)                                = 0
open("/usr/lib/i386-linux-gnu/fakechroot/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/i386-linux-gnu/i686/cmov/libnss_files.so.2", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0P\32\0\0004\0\0\0"..., 512) = 512
fstat64(4, {st_mode=S_IFREG|0644, st_size=42628, ...}) = 0
mmap2(NULL, 45768, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb76d6000
mmap2(0xb76e0000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x9) = 0xb76e0000
close(4)                                = 0
mprotect(0xb76e0000, 4096, PROT_READ)   = 0
mprotect(0xb76eb000, 4096, PROT_READ)   = 0
munmap(0xb786c000, 89825)               = 0
open("/etc/passwd", O_RDONLY)           = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=1644, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7881000
_llseek(4, 0, [0], SEEK_CUR)            = 0
read(4, "root:x:0:0:root:/root:/bin/bash\n"..., 4096) = 1644
close(4)                                = 0
munmap(0xb7881000, 4096)                = 0
open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=1534672, ...}) = 0
mmap2(NULL, 1534672, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb755f000
close(4)                                = 0
stat64("/home/consoleuser/fakechroot/stable", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
chdir("/home/consoleuser/fakechroot/stable/") = 0
open("/home/consoleuser/fakechroot/stable/bin/true", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\2\0\3\0\1\0\0\0 \213\4\0104\0\0\0"..., 4094) = 4094
close(4)                                = 0
execve("/home/consoleuser/fakechroot/stable/bin/true", ["/bin/true"], [/* 25 vars */]) = 0
brk(0)                                  = 0x94ef000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77cd000
open("/usr/lib/i386-linux-gnu/fakechroot/tls/i686/sse2/cmov/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/tls/i686/sse2/cmov", 0xbfb84020) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/tls/i686/sse2/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/tls/i686/sse2", 0xbfb84020) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/tls/i686/cmov/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/tls/i686/cmov", 0xbfb84020) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/tls/i686/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/tls/i686", 0xbfb84020) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/tls/sse2/cmov/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/tls/sse2/cmov", 0xbfb84020) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/tls/sse2/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/tls/sse2", 0xbfb84020) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/tls/cmov/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/tls/cmov", 0xbfb84020) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/tls/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/tls", 0xbfb84020) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/i686/sse2/cmov/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/i686/sse2/cmov", 0xbfb84020) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/i686/sse2/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/i686/sse2", 0xbfb84020) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/i686/cmov/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/i686/cmov", 0xbfb84020) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/i686/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/i686", 0xbfb84020) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/sse2/cmov/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/sse2/cmov", 0xbfb84020) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/sse2/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/sse2", 0xbfb84020) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/cmov/libfakechroot.so", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i386-linux-gnu/fakechroot/cmov", 0xbfb84020) = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/libfakechroot.so", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\2000\0\0004\0\0\0"..., 512) = 512
fstat64(4, {st_mode=S_IFREG|0644, st_size=89056, ...}) = 0
mmap2(NULL, 92136, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb77b6000
mmap2(0xb77cb000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x14) = 0xb77cb000
close(4)                                = 0
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/usr/lib/i386-linux-gnu/fakechroot/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/usr/lib/tls/i686/sse2/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/usr/lib/tls/i686/sse2/cmov", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/usr/lib/tls/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/usr/lib/tls/i686/sse2", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/usr/lib/tls/i686/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/usr/lib/tls/i686/cmov", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/usr/lib/tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/usr/lib/tls/i686", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/usr/lib/tls/sse2/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/usr/lib/tls/sse2/cmov", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/usr/lib/tls/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/usr/lib/tls/sse2", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/usr/lib/tls/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/usr/lib/tls/cmov", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/usr/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/usr/lib/tls", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/usr/lib/i686/sse2/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/usr/lib/i686/sse2/cmov", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/usr/lib/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/usr/lib/i686/sse2", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/usr/lib/i686/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/usr/lib/i686/cmov", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/usr/lib/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/usr/lib/i686", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/usr/lib/sse2/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/usr/lib/sse2/cmov", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/usr/lib/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/usr/lib/sse2", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/usr/lib/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/usr/lib/cmov", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/usr/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/usr/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/home/consoleuser/fakechroot/stable/lib/tls/i686/sse2/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/lib/tls/i686/sse2/cmov", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/lib/tls/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/lib/tls/i686/sse2", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/lib/tls/i686/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/lib/tls/i686/cmov", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/lib/tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/lib/tls/i686", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/lib/tls/sse2/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/lib/tls/sse2/cmov", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/lib/tls/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/lib/tls/sse2", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/lib/tls/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/lib/tls/cmov", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/lib/tls", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/lib/i686/sse2/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/lib/i686/sse2/cmov", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/lib/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/lib/i686/sse2", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/lib/i686/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/lib/i686/cmov", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/lib/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/lib/i686", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/lib/sse2/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/lib/sse2/cmov", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/lib/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/lib/sse2", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/lib/cmov/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/home/consoleuser/fakechroot/stable/lib/cmov", 0xbfb83f70) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/lib/libc.so.6", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320m\1\0004\0\0\0"..., 512) = 512
fstat64(4, {st_mode=S_IFREG|0755, st_size=1319176, ...}) = 0
mmap2(NULL, 1329480, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb7671000
mprotect(0xb77af000, 4096, PROT_NONE)   = 0
mmap2(0xb77b0000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x13e) = 0xb77b0000
mmap2(0xb77b3000, 10568, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb77b3000
close(4)                                = 0
open("/usr/lib/i386-linux-gnu/fakechroot/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/usr/lib/libdl.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/consoleuser/fakechroot/stable/lib/libdl.so.2", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@\n\0\0004\0\0\0"..., 512) = 512
fstat64(4, {st_mode=S_IFREG|0644, st_size=9736, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7670000
mmap2(NULL, 12408, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb766c000
mmap2(0xb766e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x1) = 0xb766e000
close(4)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb766b000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb766b6c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0xb766e000, 4096, PROT_READ)   = 0
mprotect(0xb77b0000, 8192, PROT_READ)   = 0
mprotect(0xb77cb000, 4096, PROT_READ)   = 0
mprotect(0xb77eb000, 4096, PROT_READ)   = 0
getuid32()                              = 1000
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Segmentation fault
139 consoleuser@stylus:~/fakechroot$


i'm not sure how to debug further, but i welcome any suggestions.

Thanks for maintaining fakechroot!

#650234#10
Date:
2011-11-28 02:48:22 UTC
From:
To:
This appears to be related to an interaction between ld-linux.so.2 from
sid's libc6 (2.13-21) and libc.so.6 from squeeze's libc6 (2.11.2-10).
Here we see that libc works fine against the old ld-linux, but segfaults
with the new ld-linux:

0 root@stylus:/tmp# find x \! -type d -ls
862137   16 -rwxr-xr-x   1 root     root        16060 Nov 27 20:32 x/bin/true
862136 1296 -rwxr-xr-x   1 root     root      1319176 Nov 27 20:31 x/lib/libc-2.11.2.so
862142 1292 -rwxr-xr-x   1 root     root      1314952 Nov 27 21:40 x/lib/libc-2.13.so
862140  116 -rwxr-xr-x   1 root     root       113964 Nov 27 21:10 x/lib/ld-2.11.2.so
862141  120 -rwxr-xr-x   1 root     root       117960 Nov 27 21:10 x/lib/ld-2.13.so
862138    0 lrwxrwxrwx   1 root     root           14 Nov 27 20:32 x/lib/libc.so.6 -> libc-2.11.2.so
862139    0 lrwxrwxrwx   1 root     root           12 Nov 27 21:14 x/lib/ld-linux.so.2 -> ld-2.11.2.so
0 root@stylus:/tmp# chroot x /bin/true
0 root@stylus:/tmp# ln -sf ld-2.13.so x/lib/ld-linux.so.2
0 root@stylus:/tmp# chroot x /bin/true
Segmentation fault
139 root@stylus:/tmp#

Since fakechroot can't intercept the loading of ld-linux.so (the
LD_PRELOAD hack is actually implemented by ld-linux.so itself), the
resulting process of a fakechroot invocation from sid to squeeze is
using sid's ld-linux to load squeeze's libc6, which causes the
segmentation fault seen above.

Should we be able to expect to run squeeze's libc against sid's
ld-linux.so?  I don't know.

I do note that we can use squeeze's ld-linux against sid's libc, though:

0 root@stylus:/tmp# ls -l x/lib
total 2824
-rwxr-xr-x 1 root root  113964 Nov 27 21:10 ld-2.11.2.so
-rwxr-xr-x 1 root root  117960 Nov 27 21:10 ld-2.13.so
lrwxrwxrwx 1 root root      12 Nov 27 21:41 ld-linux.so.2 -> ld-2.11.2.so
-rwxr-xr-x 1 root root 1319176 Nov 27 20:31 libc-2.11.2.so
-rwxr-xr-x 1 root root 1314952 Nov 27 21:40 libc-2.13.so
lrwxrwxrwx 1 root root      12 Nov 27 21:40 libc.so.6 -> libc-2.13.so
0 root@stylus:/tmp# chroot x /bin/true
0 root@stylus:/tmp#

I'm sorry i don't know how to solve this problem, but i'd be happy to
see it re-assigned to a different package (eglibc?) if you think that
would help move it toward a resolution.

If you want more debugging info, just let me know.

Regards,

#650234#17
Date:
2012-04-13 02:07:13 UTC
From:
To:
forcemerge 650234 649146
reassign 650234 eglibc
retitle 650234 eglibc: libc-2.11.x.so segfaults when used with ld-2.13.so
thanks

Hi, this seems more of an eglibc issue, so I am reassigning.  Daniel
Kahn Gillmor did a lot of useful tinkering in
http://bugs.debian.org/650234.

Thanks,
Mike

#650234#20
Date:
2012-04-13 02:07:13 UTC
From:
To:
forcemerge 650234 649146
reassign 650234 eglibc
retitle 650234 eglibc: libc-2.11.x.so segfaults when used with ld-2.13.so
thanks

Hi, this seems more of an eglibc issue, so I am reassigning.  Daniel
Kahn Gillmor did a lot of useful tinkering in
http://bugs.debian.org/650234.

Thanks,
Mike

#650234#31
Date:
2012-04-13 18:15:35 UTC
From:
To:
reassign 649146 eglibc
forcemerge 650234 649146
thanks

Hi,

I am reassigning these bugs.  See the 650234 bug log for tinkering
done so far by Daniel Kahn Gillmor.

Best wishes,
Mike

#650234#38
Date:
2012-04-26 15:13:39 UTC
From:
To:
libc-2.13.so and ld-2.11.so with libc-2.11.so. It's totally normal to
expect crashes when trying to mix versions here.

-
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

#650234#45
Date:
2012-10-23 05:37:35 UTC
From:
To:
Any progress as solving #650234?  Reads like the problem has been
identified, but no solution has come up.  I've got no idea if any
possible solutions are visible...

One thought, in wrapping execve(), use "<chroot>/lib/ld-linux.so.2" as
the filename.  Push "<chroot>/lib/ld-linux.so.2" on to argv[], then use
the filename as argv[1].  This means invoked programs will always see
their full pathname as argv[0], but ensures the chroot's loader is used.

Another thought, perhaps try loading ld.so's version of libc?  I'd
seriously worry about chroot programs needing a later version, but might
handle easier cases.

#650234#50
Date:
2012-10-24 04:21:50 UTC
From:
To:
Simple test I tried in a test chroot image area:

user@host:~/build$ fakechroot
user@host:~/build$ chroot test.image
Segmentation fault
user@host:~/build$ chroot test.image /lib/ld-linux.so.2 /bin/bash
user@host:/$ ls
Segmentation fault
user@host:/$ /lib/ld-linux.so.2 ls
ls: error while loading shared libraries: ls: cannot open shared object file: No such file or directory
user@host:/$ /lib/ld-linux.so.2 /bin/ls
bin   debootstrap  etc	 lib  proc  sbin     sys  usr
boot  dev	   home  mnt  root  selinux  tmp  var
user@host:/$ exit

So, something along these lines is possible.  I suspect using the
chroot's version of ld-linux.so.2 is a better bet than trying to use the
system's libc.so.  The one question is, the original argv[0] can be
stashed in the environment, but can argv[0] be swaped out by a LD_PRELOAD
library?

#650234#55
Date:
2012-10-24 07:32:55 UTC
From:
To:
unmerge 626482
reassign 650234 fakechroot 2.15-1
severity 650234 important
tags 650234 + upstream
quit

Elliott Mitchell wrote:
[...]

Thanks.  Indeed, ideally fakechroot's execve should look up the
interpreter filename from the ELF .interp section, map it according to
the faked chroot, and set argv[0].  The hard part is the ELF parsing.

Hints for inspiration[1]:

  git://github.com/NixOS/patchelf.git
https://fedorahosted.org/elfutils/

Doable, though it seems a little too much like work for me to actually
do it. ;-)  Reassigning because I can't imagine glibc changing its
compatibility requirements any time soon.

Hope that helps,
Jonathan

[1] some pseudocode to experiment with for your amusement:

diff --git i/src/execve.c w/src/execve.c
index 60351177..70d0a9ea 100644
--- i/src/execve.c
+++ w/src/execve.c
@@ -71,6 +71,25 @@ static int try_cmd_subst (char * env, const char * filename, char * cmd_subst)
     return 0;
 }

+static int get_elf_interp(const char * filename, char * buf, size_t buflen)
+{
+    int num_sections = num_sections();  /* header->e_shnum */
+    int i;
+
+    for (i = 0; i < num_sections; i++) {
+        string section_name = section_names + section_header[i].sh_name;
+        if (section_name == ".interp")  /* found it! */
+            break;
+    }
+    if (i == num_sections)
+        return -1;
+
+    // found .interp section
+    size_t offset = section_hdr.sh_offset;
+    size_t size = section_hdr.sh_size;
+    ...
+}
+

 wrapper(execve, int, (const char * filename, char * const argv [], char * const envp []))
 {
@@ -195,8 +214,11 @@ wrapper(execve, int, (const char * filename, char * const argv [], char * const
     }

     /* No hashbang in argv */
-    if (hashbang[0] != '#' || hashbang[1] != '!')
-        return nextcall(execve)(filename, argv, newenvp);
+    if (hashbang[0] != '#' || hashbang[1] != '!') {
+        if (get_elf_interp(filename, hashbang + 2, sizeof(hashbang) - 3))
+            return nextcall(execve)(filename, argv, newenvp);
+        i = strlen(hashbang);
+    }

     /* For hashbang we must fix argv[0] */
     hashbang[i] = hashbang[i+1] = 0;

#650234#70
Date:
2012-10-25 01:02:00 UTC
From:
To:
found 2.9-1.1+squeeze1
found 2.16-1
quit

This appears to be an issue for a lot more than just 2.15-1.  I could be
wrong, but I'd assume it is in pretty well every version.

#650234#81
Date:
2013-11-27 21:15:19 UTC
From:
To:
2012/10/24 Jonathan Nieder <jrnieder@gmail.com>:

1. The glibc dynamic loader can't change argv[0] to other value than
the file name. It means that some apps are broken, ie. busybox. See
https://sourceware.org/bugzilla/show_bug.cgi?id=16124

2. Using dynamic loader directly from command line is possible but the
loader is less stable and coredumps sometimes.

You can test it already, eg. calling

FAKECHROOT_ELFLOADER=/lib64/ld-linux-x86-64.so.2

from test directory of fakechroot source. You should expect that
debootstrap environment can be created but calling debian/rules or
even ./configure in such environment fails.

Perhaps there is another possibility: to change .interp section for
every binary file in fake chroot environment: off-line or even
on-the-fly. I think about similar to chrpath tool which can change
another ELF section.

#650234#84
Date:
2013-12-06 00:33:28 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
fakechroot, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 649146@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Piotr Roszatycki <dexter@debian.org> (supplier of updated fakechroot package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Thu, 05 Dec 2013 22:14:14 +0100
Source: fakechroot
Binary: fakechroot libfakechroot
Architecture: source all amd64
Version: 2.17.1-1
Distribution: unstable
Urgency: low
Maintainer: Piotr Roszatycki <dexter@debian.org>
Changed-By: Piotr Roszatycki <dexter@debian.org>
Description:
 fakechroot - gives a fake chroot environment - utilities
 libfakechroot - gives a fake chroot environment - runtime
Closes: 533560 582478 582479 631390 649146 663967 664121 691538 694827 697465 700816 720641 720643 720645 720647 720648 726161 730981
Changes:
 fakechroot (2.17.1-1) unstable; urgency=low
 .
   * New upstream release:
     - It is safe to use relative paths which won't escape from fake chroot.
       Closes: #533560, #582478, #582479, #663967.
     - More bugfixes. Closes: #631390, #649146, #664121, #691538, #694827,
       #697465, #700816, #720641, #720643, #720645, #720647, #720648, #730981.
   * Use dh_autoreconf to update config.guess and config.sub for arm64. Thanks
     to Colin Watson. Closes: #726161.
Checksums-Sha1:
 0c1754ca8202c3f39968f74803afc6449dbe850e 1314 fakechroot_2.17.1-1.dsc
 499589449ed80e227c0ebe262f5e210a2e9978ed 461563 fakechroot_2.17.1.orig.tar.gz
 8244d99eeab2c7bc057a00030e10515df78ec961 8907 fakechroot_2.17.1-1.debian.tar.gz
 bea2771ab61c4e64f7afce0b4254cd2e23038da9 28492 fakechroot_2.17.1-1_all.deb
 1b052e43697565f665189dfc9a4456c87ffe0969 40650 libfakechroot_2.17.1-1_amd64.deb
Checksums-Sha256:
 f4ff65496e320f5a61e4b5d1e482785c2a5e96ddf28fa98fe509bfee8e2ad59a 1314 fakechroot_2.17.1-1.dsc
 7662279b38f4cab0475d432872dde328e774f17306448abc98033ece35999315 461563 fakechroot_2.17.1.orig.tar.gz
 db68914921d2ad7cb9ba183863a524f5034501e0013942e8338ace9f2a349f04 8907 fakechroot_2.17.1-1.debian.tar.gz
 d3ccaca2a6a6482d4754172db8f36c0f242ae89de4eb21f18f3c99e6457c189e 28492 fakechroot_2.17.1-1_all.deb
 74e0452d091386bf39f5b11fffb866fe14602fa2ac4f993d53b6aff0cd211980 40650 libfakechroot_2.17.1-1_amd64.deb
Files:
 d6c2d8f94a83f77b3231c80b639f0c33 1314 utils optional fakechroot_2.17.1-1.dsc
 3c17eff0c854a77f98b4d0db086bc5bc 461563 utils optional fakechroot_2.17.1.orig.tar.gz
 741b102d298ecfb8d7a4b6b690245512 8907 utils optional fakechroot_2.17.1-1.debian.tar.gz
 a3dbcdacc8c9a79a362dab705c8d2d7e 28492 utils optional fakechroot_2.17.1-1_all.deb
 1c3581efc0e422760b406981ecb232c9 40650 libs optional libfakechroot_2.17.1-1_amd64.deb
iEYEARECAAYFAlKhGHcACgkQhMHHe8CxCls2ygCg6sYz89upVHUuGu6iTNOVoUys
UmkAnjyNLL+lnr1lxscWd9U6l12eCsE4
=PN5Y
-----END PGP SIGNATURE-----

#650234#89
Date:
2013-12-06 00:32:15 UTC
From:
To:
This means this particular avenue of replacing argv[0] isn't open, but
how do you claim busybox is broken without argv[0] being replaced?  Your
proposed feature for the runtime linker would allow for argv[0] being
replaced, but not being able to replace argv[0] with the passed value
shouldn't break anything (and a quick check indicates busybox works just
fine without it).  Being able to replace argv[0] would mean could get at
busybox's `ls` or `sh` personalities without having the requisite
symbolic links.

Each command implemented by busybox is accompanied by a symbolic link to
the busybox binary (/bin/ls -> busybox, /bin/sh -> busybox. /usr/bin/expr
-> /bin/busybox, et al).

Now, the weakness of my solution without replacing argv[0] is merely that
the executed program sees the full path, but busybox deals with this just
fine.  Normally if I type `ls -l /` into a shell, the program will see as
its arguments: { "ls", "-l", "/" } without the capability the program
will instead see: { "/bin/ls", "-l", "/" }, mainly argv[0] has the full
path instead of just the filename.  Any program that changes behavior
based on argv[0] *should* be striping everything up to the last '/', but
I wouldn't be surprised if some fail to do this (but busybox isn't one of
those).

I dislike that executed programs see something different than if they
were called normally, but this shouldn't effect anything.  My biggest
concern is this uses additional space in the environment and *might*
cause issues if someone was right up against the limits (hello, xargs).

Hmm...   Two explanations come up for this.  Is the debootstrap
environment i386, or amd64?  I'm unsure of whether the amd64 runtime
loader can handle loading i386 binaries (I *hope* it isn't a mixed
environment, but this could be a problem).  Second, this may be an issue
of shell scripts.  I wouldn't be surprised if both of these were issues.
Unfortunately this reads like an issue where you're going to have to look
at the file being executed and behave appropriately, at least shell
scripts are easy to handle.

I suspect you're overthinking the problem.  Thank you for taking on this
bug, for the right situations fakechroot is a very handy tool.

#650234#94
Date:
2014-01-13 06:31:21 UTC
From:
To:
repen 650234
quit

I guess I'm wondering whether I should be letting #650234 close and we
need a separate bug for the current phase...   The provided explanation
of the status does not make sense.  The explanation I can come up with is
the wrapping is working, except around shell scripts.  For shell scripts
you would have the problem of arguments: /lib/ld-linux.so.2 shell.sh
which won't work.  I'm guessing you'll need to scan executables so the
right one is invoked (the fakechroot()'s installed utility may be later
than the system one).

#650234#103
Date:
2017-11-26 13:52:59 UTC
From:
To:
Hi,

This bug is still present and nowadays prevents debootstrap to create an
amd64 wheezy chroot on a current amd64 sid, or pbuilder to work with a
previously created wheezy base-tgz.

I'm not coder, so maybe this remark will seem obvious to some, but
creating an i386 wheezy chroot on a current amd64 sid system works
correctly though. I imagine that the difference in architectures forces
fakechroot to use the linker (or some other part, I don't quite
understand the problem) from the chroot. Can't this behavior be mimicked
when the architecture is the same ? Again, I'm no coder, please don't
take offense if this is a silly question.

As wheezy is now LTS, this bug is quite annoying since it prevents
maintainers to use pbuilder to maintain packages for wheezy (I currently
have to use a VM).

Regards,

#650234#108
Date:
2021-03-06 23:49:49 UTC
From:
To:
Commenting out the lines mentioning fakechroot_chroot_paths_ldsoconf
in /usr/sbin/chroot.fakechroot, and the resulting spurious "fi",
avoids this problem.

Ralph.