Source-Changes archive

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

Re: CVS commit: src/libexec/ld.elf_so



mycroft%netbsd.org@localhost said:
> Modified Files:
>       src/libexec/ld.elf_so: rtld.c rtld.h symbol.c
> Log Message:
> Attempt to give dlsym() the same symbol-searching
> semantics as _rtld_bind(). 

This leads to unexpected behaviour. The appended program finds
the locally defined symbol although libc is explicitely opened.

before:
$ ./a.out
found 0x480746d0, local is 0x8048a00

now:
$ ./a.out
found 0x80489f8, local is 0x80489f8

This breaks eg GNU pth-2.0 which tries to intercept libc calls.

best regards
Matthias


#include <stdio.h>
#include <dlfcn.h>
#include <err.h>

int
select()
{
        return 0;
}

int
main()
{
        void *hdl, *addr;

        hdl = dlopen("/lib/libc.so", RTLD_LAZY);
        if (!hdl)
                errx(1, "dlopen: %s", dlerror());
        addr = dlsym(hdl, "select");
        if (!addr)
                errx(1, "dlsym: %s", dlerror());

        printf("found %p, local is %p\n", addr, &select);
        exit(0);
}


Home | Main Index | Thread Index | Old Index