run-as-anonymous segfaults when built with dietlibc
- Found in: 1.19.svn.2008-05-12 in Ubuntu feisty i386
CategoryFixed: fixed in 771 for release 1.20
If dietlibc-dev is installed when Plash is built, it will build the statically-linked /var/lib/plash-chroot-jail/run-as-anonymous using dietlibc instead of glibc.
This causes a segfault when using nested pola-run:
$ ./run-mostly-installed.sh pola-run-c -fw / -e pola-run-c -fw / -e echo foo Segmentation fault
The executable segfaults when run directly:
$ strace ./setuid/run-as-anonymous_static
execve("./setuid/run-as-anonymous_static", ["./setuid/run-as-anonymous_static"...], [/* 25 vars */]) = 0
[ Process PID=26150 runs in 32 bit mode. ]
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV (core dumped) +++
Disassembling the executable with objdump -d shows that it has linked against __stack_chk_fail. The solution is to build it with -fno-stack-protector. (Isn't dietlibc supposed to support -fstack-protector though?)
It is not good that the build system's behaviour changes when dietlibc-dev is installed.
Resolution
Fix building with dietlibc. Add -fno-stack-protector. Fix problem of setuid32() not being defined by dietlibc on x86-64.
Always build this with dietlibc: added build dependency on dietlibc-dev.
