run-as-anonymous segfaults when built with dietlibc

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

PlashIssues/DietlibcChrootSegfault (last edited 2008-05-13 17:24:47 by MarkSeaborn)