NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/41205: find already loaded library by basename



>Number:         41205
>Category:       lib
>Synopsis:       ld.elf_so does not find already loaded library
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 14 18:15:00 +0000 2009
>Originator:     Arto Huusko
>Release:        NetBSD 5.99.10
>Organization:
>Environment:
>Description:
    Consider this. Two libraries

    - /path/to/server/libjvm.so
    - /path/to/libverify.so
      This library has NEEDED libjvm.so
    - Neither libjvm nor libverify is on LD_LIBRARY_PATH
    - Executable dlopens libjvm.so by complete path name.
    - libjvm.so dlopens libverify.so by complete path name.
    -> Loading libverify.so fails, because libjvm.so is not found.

    I am unsure if this should even work, but apparently it does on
    Linux and Solaris. I thought I'd submit this anyway, so it does not
    get lost.

    This problem occurs with Java 6u14 and the new plugin.
    Starting Java apps is not a problem (with java -jar ... for example),
    because apparently Java launcher finds libjvm.so, and then adjusts
    LD_LIBRARY_PATH and execs the vm. However, using the new browser plugin
    does not work, because the plugin (libnpjp2.so) loads libjvm.so directly
    in to the browser process, and can't adjust LD_LIBRARY_PATH anymore.
    Therefore libjvm.so loading libverify.so fails, because ld.elf_so
    does not find libjvm.so for libverify.so.
>How-To-Repeat:
    -
>Fix:
    I wrote the following simple patch to see if any of the already loaded
    objects has the same basename as the requested library when complete
    path is not specified:

Index: search.c
===================================================================
RCS file: /cvsroot/src/libexec/ld.elf_so/search.c,v
retrieving revision 1.21
diff -r1.21 search.c
159a160,168
>       /* Search by name from already loaded objects */
>       for (obj = _rtld_objlist->next ; obj != NULL ; obj = obj->next) {
>               char *namestart = strrchr(obj->path, '/');
>               if (namestart != NULL) {
>                       if (strcmp(++namestart, name) == 0)
>                               goto pathfound;
>               }
>       }
> 



Home | Main Index | Thread Index | Old Index