Subject: Re: CVS commit: src/libexec/ld.elf_so
To: None <mycroft@netbsd.org>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: source-changes
Date: 04/24/2003 14:52:09
This is a multipart MIME message.

--==_Exmh_12838862300000
Content-Type: text/plain; charset=us-ascii


mycroft@netbsd.org 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



--==_Exmh_12838862300000
Content-Type: text/plain ; name="dlsymtest.c"; charset=us-ascii
Content-Description: dlsymtest.c
Content-Disposition: attachment; filename="dlsymtest.c"

#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);
}

--==_Exmh_12838862300000--