1

Where does the filtering of environment variables occur? for instance, say you are using LD_PRELOAD for shared library interposition. However, when a setuid program is run, the LD_PRELOAD variable has no effect. It represents a case of what I am dubbing "environment variable filtering." I was wondering where the processing and 'purging' of environment variables takes place, specifically and/or precisely.

Kalle Richter
  • 8,008
  • 26
  • 77
  • 177
bazz
  • 413
  • 6
  • 14
  • There's plenty of examples out there (google) – Gilles Quénot Oct 10 '12 at 23:18
  • please point me in the right direction. I did not find anything. – bazz Oct 11 '12 at 05:21
  • http://stackoverflow.com/questions/426230/what-is-the-ld-preload-trick – Gilles Quénot Oct 11 '12 at 13:16
  • Nope, I am looking for environment variable filtering. That link is all about LD_PRELOAD and how it is a library interposer over shared libraries. My question is, where does the filtering of environment variables occur? My question only used LD_PRELOAD as an example because, for instance, when an setuid program is run, the LD_PRELOAD variable will not work. It represents a case of this environment variable filtering, or nullification. I was wondering where on the OS level the processing and 'purging' of environment variables takes place. – bazz Oct 12 '12 at 01:25

1 Answers1

3

The dynamic loader deals with LD_PRELOAD and related environment variables. It also determines whether a program is running SUID and ignores the environment variables.

The actual name and location of the dynamic loader varies by system. For example, on RHEL 5 for x86/64, the library is /lib/ld-linux.so.2 for 32-bit software and /lib64/ld-linux-x86-64.so.2 for 64-bit software; on Solaris 10 for SPARC, there's /lib/ld.so.1 for 32-bit code, and /lib/sparcv9/ld.so.1 for 64-bit code.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278