Problem with LD_PRELOAD
Daniel Jacobowitz
drow@mvista.com
Tue Mar 19 15:37:00 GMT 2002
On Tue, Mar 19, 2002 at 03:24:45PM -0800, Ian Lance Taylor wrote:
> Manuel Arriaga <m.arriaga@ip.pt> writes:
>
> > So my question is: why aren't all calls to open() being redirected to the
> > preloaded object? Why does this redirection only work in some cases?
>
> I would guess that cp is not calling open(). strace does not report
> the libc functions called by a program. It reports the system calls
> called by a program. I would guess that cp is calling some libc
> function which calls the system call open(). Use objdump -T to see
> which dynamic symbols appear in cp; if open() is not one of them, then
> using LD_PRELOAD will not be able to intercept calls to open().
Also, to override functions in GNU libc, you need to provide versioned
symbols using the same versions as GNU libc uses. I'd recommend a good
reference on ELF symbol versioning, but I don't know one :)
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
More information about the Binutils
mailing list