Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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:

  1. Establish a chroot-jail using debootstrap
  2. In the C program do a chroot into the jail created by dbootstrap.
  3. 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[9695]: segfault at 3ea ip b752ee29 sp bf986c70 error 4 in libc-2.15.so[b74ea000+1a3000]
================================
share|improve this question
Could you paste the C source of your file? – Jeremy Kerr Nov 13 '12 at 5:12
Also, your title mentions setguid(), which isn't a syscall, but your description mentions setgid(), which will set the group ID, not the user ID. Do you mean to call setuid() instead, to actually drop user privileges? – Jeremy Kerr Nov 13 '12 at 5:18

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.