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]
Other format: [Raw text]

Re: [Fwd: Overriding glibc functions]


On Fri, Oct 18, 2002 at 06:50:02PM -0700, Jeremy Fitzhardinge wrote:
> On Fri, 2002-10-18 at 17:52, H. J. Lu wrote:
> > > OK, but valgrind.so is already being linked with "-z initfirst"; what
> > > happens if there are two .so files with initfirst? (It does seem to
> > > work).
> > 
> > Which ever comes first wins
> 
> So if the order of events is:
> 
> 1. run executable A, with LD_PRELOAD=valgrind.so (which has initfirst
> set)
> 2. A uses function foo() which is defined in libc.so
> 3. A doesn't use libpthread, but after a while it dlopens libB.so, which
> does
> 4. libB.so pulls in Valgrind's libpthread.so.
> 5. Valgrind's libpthread.so wants to override foo(), now that this has
> become a multithreaded program.  If A uses foo() again, which definition
> will it get?  libc's original one (which it was using before), or the
> new definition in libpthread.so?
> 

I think A will always use the original foo. BTW, if libB.so is
dlopened, it becomes very tricky. See

http://sources.redhat.com/ml/libc-alpha/2002-05/msg00214.html


H.J.


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