[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: library fuction calls
On Thu, 22 Feb 2001, Raja Subramanian wrote:
> If your program that you are trying to work with is not available in source,
> and you want to replace the connect calls with your own - you need a library
> interposer. Have a look at
> http://www.unixinsider.com/swol-09-2000/swol-0929-interposers.html
> for details. This takes advantage of dynamic linking, but does not always work
> (on setuid progs for example).
>
Thanks a lot :). This is almost what I wanted. But still there is
a small problem. I tried the malloc interposer from the site. I feel it is
written for solaris cc. So here are my questions (again :)
1. It says cc -o malloc_interposer.so -G -Kpic malloc_interposer.c
Now gcc does not have -G and -K option. I feel one of them is for
-shared (which one and what about the other)
2. Compiled with gcc -shared -o malloc_interposer.so malloc_interposer.c
and then setting the LD_PRELOAD to the shared lib. Now "ls" gives the
problem:
<ajayd:tconn>/bin/ls
ls: error in loading shared libraries:
/home/ajayd/tconn/malloc_interposer.so: undefined symbol: dlsym
However it is working fine for echo
<ajayd:tconn>/bin/echo
malloc(176) is called
malloc(176) is called
malloc(52) is called
<snipped>
It is also working with vi,date etc.. but not ls
Any ideas ?
PS: I tested the code on a solaris machine, and it worked for everything.
--
#!!! If anything can go wrong, _FIX_ it. (To hell with MURPHY)
Ajay kumar Dwivedi
ajayd@xxxxxxxxxx