As below I found in Ubuntu 12.04, I found that I get the segfault, even though I follow the right procedure. The same code seem to work on RedHat distrubution:
- Establish a chroot-jail using debootstrap
- In the C program do a chroot into the jail created by dbootstrap.
- Then to drop privileges, within the chroot jail, in the forked process, call setgid(existinguser).
Then one gets segfault as below. This doesn't happen, if the chroot is to "/". I wonder whether the chroot environment created by debootstrap is a problem. The output is below:
======== start here ======== ubuntu12-04 kernel: [ 8595.902026] ae: segfault at 3ea ip b752ee29 sp bf986c70 error 4 in libc-2.15.so[b74ea000+1a3000] ================================