[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: /usr/bin/ld.so as a symbolic link for the dynamic loader



On Fri, Dec 03, 2021 at 11:33:25AM -0500, Theodore Y. Ts'o wrote:
> Some stupid questions that I couldn't answer by reading the man page
> or doing a quick google search....
> * How does ld.so --preload *work*?

ld.so is the ELF interpreter.  If you run a normal binary, the kernel
rewrites this request to load and execute /lib64/ld-linux-x86-64.so.2
instead.  This interpreter then loads the real binary, the libraries and
jumps to the real code.

If you run ld.so directly, that kernel redirection is just not done.
The rest of it's tasks however are done just as usual.

--preload is just as if the interpreter would see LD_PRELOAD set.

> * Does it modify /bin/ls, so that all users running /bin/ls get the
> preloaded library?

No, preload does not modify binary files, just the loaded binary in
memory.

> * Does it modify something in the user's home directory?

No.

> * How do you undo the effects ld.so --preload?

You just don't use ld.so and don't set LD_PRELOAD.

Bastian

-- 
He's dead, Jim.
		-- McCoy, "The Devil in the Dark", stardate 3196.1


Reply to: