title: Program can't load after setting the setuid bit on
body: <p>Consider this scenario in which an executable A.bin uses libY.so and libZ.so. A.c, Y.c and Z.c are all written in C.
  Z.c and Y.c are compiled into respective .so files.</p>
  
  <p>This is the directory structure of the files</p>
  
  <p>$home/bin/A.bin
  $home/lib/libY.so
  $home/lib/libZ.so</p>
  
  <p>When I run A.bin as normal user, A.bin runs normally as expected.
  Note: $LD_LIBRARY_PATH contains $home/lib</p>
  
  <p>I changed some code in A.c adding some functionality which needs admin privileges(like binding to a port less than 1000).
  I set the setuid bit for A.bin, libY.so and libZ.so to rwsrwsrws, and change the ownership of the files to root. When I try to run A.bin, I get the following error</p>
  
  <p>ld.so.1: A.bin: fatal: libY.so: open failed: No such file or directory
  Killed</p>
  
  <p>When I just remove the setuid permission from all those files, then the binary runs except for the functionality fails where it needs root privileges.</p>
  
  <p>How to overcome this problem ?</p>
  
  <p>Edit: The OS is Solaris 5.10</p>