Build of chroot-jail fails because strip segfaults
Found in: 849 on Ubuntu intrepid
CategoryFixed. Fixed in 876
Building the chroot-jail package fails on Ubuntu intrepid on amd64 but not on i386.
... dh_strip dh_strip: command returned error code 11 make: *** [binary-arch] Error 1 dpkg-buildpackage: failure: fakeroot debian/rules binary gave error exit status 2
It appears that strip segfaults on run-as-anonymous_static (built with dietlibc), but not other executables.
$ strip setuid/run-as-anonymous_static -o setuid/run-as-anonymous_static1 Segmentation fault (core dumped) $ ./setuid/run-as-anonymous_static Usage: ./setuid/run-as-anonymous_static [--debug] [-s ENVVAR=VALUE]... program args...
The gutsy version of strip also segfaults on the same executable. (Presumably gutsy's dh_strip misses this executable.)
Test case
$ cat test.c
#include <stdio.h>
int main() { fprintf(stderr, "hello\n"); return 0; }
$ diet gcc test.c -o test
/usr/lib/diet/lib-x86_64/libc.a(stderr.o): In function `__fflush_stderr':
stderr.c:(.text+0x8): warning: warning: your code uses stdio (7+k bloat).
$ objdump -p test
test: file format elf64-x86-64
Program Header:
LOAD off 0x0000000000000000 vaddr 0x0000000000400000 paddr 0x0000000000400000 align 2**21
filesz 0x0000000000000930 memsz 0x0000000000000930 flags r-x
LOAD off 0x0000000000000ff0 vaddr 0x0000000000600ff0 paddr 0x0000000000600ff0 align 2**21
filesz 0x0000000000000118 memsz 0x0000000000001290 flags rw-
STACK off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**3
filesz 0x0000000000000000 memsz 0x0000000000000000 flags rwx
RELRO off 0x0000000000000ff0 vaddr 0x0000000000600ff0 paddr 0x0000000000600ff0 align 2**0
filesz 0x0000000000000010 memsz 0x0000000000000010 flags r--
$ ./test
hello
$ strip test
Segmentation fault (core dumped)
I'm not sure about the RELRO segment. Don't think I've seen those before. Doesn't appear in dynamically-linked executables or in dietlibc executables for i386 or earlier Ubuntus.
I raised an Ubuntu bug on dietlibc: #254790
I raised a bug on binutils' strip as well: #7076
Worked around it by passing -Wl,-z,norelro.
