hey all,
fyi, i eventually root-caused this problem to stupid developer error.

to test my bits i was copying the following files over to my test
system:
        foobar1.so.1
        foobar1.so   (a symlink to foobar1.so.1)

but unfortunatly i was using 'cp' to do the copy so foobar1.so on the
test machine was actually getting created as a file instead of a
symlink.

i then ran my application with foobar1.so LD_PRELOADed.  then my program
dlopen()ed foobar2.so, which was was explicitly linked against
foobar1.so.1.  so then the linker went off and did exactly what it
was supposed to do.  it loaded foobar1.so.1.

ed

On Wed, Mar 01, 2006 at 04:23:19PM -0800, Edward Pilatowicz wrote:
> hey guys,
> i have a problem that i'm not quite sure how to solve.
> here's an example of what's happening:
>
> - mkdir /a
> - mount -F lofs / /a
> - LD_PRELOAD=/a/lib/foobar1.so /foo
> - the application does chroot(/a)
> - the application does dlopen(foobar2.so), but foobar2.so was compiled
>   with a dependancy on foobar1.so.
> - the linker loads /lib/foobar1.so even though it's already loaded.
>   so now i have the same library (albiet opened via two different
>   paths) loaded into my process twice:
>       /a/lib/foobar1.so
>       /lib/foobar1.so
>
> is there any way i can get the linker to realize that this library is
> already loaded?
>
> i tried dlopen'ing foobar2.so from the initalization routine of
> foobar1.so to basically pre-load it, but the linker didn't like that.
>
> my only other idea is to remove the direct calls from foobar2.so
> to foobar1.so and then lookup the functions in foobar1.so that i
> want to call using dlsym().
>
> suggestions?  (a recommendation to get my head check could be
> a valid suggestion.)
>
> ed

Reply via email to