On Fri, Dec 03, 2021 at 05:59:17PM +0100, Florian Weimer wrote: > * Theodore Y. Ts'o: > > > * How does ld.so --preload *work*? > > The dynamic loader has an array of preloaded sonames, and it processes > them before loading the dependencies of the main program. This way, > definitions in the preloaded objects preempt definitions in the shared > objects. > > > * Does it modify /bin/ls, so that all users running /bin/ls get the > > preloaded library? > > No, it's purely a run-time change.
Ah, sorry, I was assuming it was more than just a run-time change. So this would effectively be equivalent to something like this, right? (export LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libeatmydata.so.1 $LD_PRELOAD" ; /bin/ls) By the way, it might be nice if ld.so queried something like $HOME/.config/ld.so.preload as a user-specific version of /etc/ld.so.preload. I guess there might be some potential security concerns, but if an attacker has write access to a user's home directory, they probably can do all sorts of mischief anyway.... - Ted