I am observing a curious behavior when running a program with setuid bit enabled.Program foo is owned by user bar with setuid bit set.User execbar runs foofoo reports that one of the dynamic libraries is inaccessible.The dynamic library in question is located in a directory outside the normal ld.so.conf search paths so it's set via LD_LIBRARY_PATH for user execbarThe question is:  Is running a program with setuid clears the environment set by user execbar?
Environment settings on setuid executables
environment variables;dynamic linking;setuid
No, but the dynamic linker will ignore some environment variables when run with setuid as otherwise you could make it load and run any code as the target user. That goes for LD_LIBRARY_PATH, LD_PRELOAD and more. See ld.so(8).