This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: LD_PRELOAD called multiple times for a single system call


"Stephen Done at home" <stephen.done@cw.com> writes:

> Again, this is related to an LD_PRELOAD library that I wrote and must now
> port from Solaris to Linux.
> 
> I have noticed that if you define certain functions within a library, when a
> 'preloaded' binary makes a single system call, multiple functions within the
> library may get called.
> 
> Here are a couple of examples:
> 
> 1
> =
> If a binary calls syslog(), the preload library will be called for syslog()
> and fclose() (among others perhaps). One problems this causes is that you
> can't syslog debug information inside your overidden fclose() call, since it
> causes a seg fault due to the unending recursion.

You can call the libc syscall routine directly.

> 2
> =
> If a binary calls execvp, then the preload library will receive calls to
> execvp() and execv().
>
>
> Since I am trying to create a cross platform preload library, I am trying to
> find some consistency in this.
> 
> With Solaris, you only get one hook for each call, which makes life nice and
> straightforward. It also works consistently between Solaris 2.6 & 2.8.
> 
> Is there any way to get this functionality under Linux ?
>
> Alternatively, is there a way I can determine which calls made by a binary
> trigger which multiple calls in the preload library under Linux ?

You have the source, just check it.

> Is this interface subject to change between glibc versions ?

Yes.

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]