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

Bug#165899: xlibs-dbg: no unstripped libs for /usr/X11R6/lib/X11/locale/common/*

I've thought some more deeply about the usage of unstripped libs.

On Tue, 22 Oct 2002 11:31:14 -0500
165899@bugs.debian.org wrote:

> Package: xlibs-dbg
> [...]
>  Unstripped versions of Xlib's internationalization loadable modules are
>  provided in /usr/X11R6/lib/debug/X11/locale/common.  Note that if you wish
>  to debug these modules, you will need to set XLOCALEDIR to
>  /usr/X11R6/lib/debug/X11/locale.  Also note that for security reasons,
>  unprivileged users are unable to override XLOCALEDIR in this way, so you
>  may have to perform your debugging of the Xlib modules as root.

It may worth mentioning that by intercepting dlopen() call,
 we can make a process to load alternate(unstripped) modules
without having root privilege.

How about creating dlwrap.c which looks like
------------------------BEGIN HERE------------------------
#define _GNU_SOURCE 1
#include    <dlfcn.h>
#include    <string.h>
void * dlopen(const char *filename, int flag){
	static void * (* fptr)() = 0;
	char buffer[] = "/usr/X11R6/lib/debug/X11/locale/common/0123456789ABCDEF";
	if (!fptr) {
		fptr = dlsym(RTLD_NEXT, "dlopen");
		if (!fptr) 
			return 0;
	if ((strncmp("/usr/X11R6/lib/X11/locale/common/", filename, 33) == 0) && (strlen(filename) < 33+16)){
		memcpy(buffer+32, filename+33, strlen(filename) -32);
		return ((*fptr)(buffer, flag));
	return ((*fptr)(filename, flag));
------------------------END HERE------------------------

and doing
 ~$ gcc -shared -o dlwrap.so dlwrap.c -ldl
 ~$ LD_PRELOAD=./dlwrap.so FOOBAR

Reply to: