Re: overloading system calls.

Miquel van Smoorenburg (miquels@cistron.nl)
31 May 1998 21:14:53 +0200


In article <k2n2byl3zl.fsf@zero.aec.at>, Andi Kleen <ak@muc.de> wrote:
>LD_PRELOAD=./mygetpid.so program_to_patch
>
>Note that this doesn't work when the program is setuid and you're not root.

In that case, you can ofcourse use /etc/ld.so.preload which is honored
by setuid programs and has the advantage that it is system wide - no
need to jump through hoops to make sure LD_PRELOAD is set everywhere.

>Also it is not possible to catch calls from libc because those are already
>prelinked (e.g. when you want to patch write() printf() won't be intercepted).

Usually libc itself uses __write() internally instead of write(), and
AFAIK you can happily replace those.

Mike.

-- 
 Miquel van Smoorenburg | Our vision is to speed up time,
    miquels@cistron.nl  |   eventually eliminating it.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu