This is the mail archive of the libc-hacker@sourceware.org mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi! Current directory (from empty library search path elements in LD_LIBRARY_PATH, DT_R{UN,}PATH) has r->dirnamelen == 0 and thus mempcpy , r->dirnamelen - 1) crashes on it. While fixing this I have noticed that searchpath elements / (the only ones that can have dirnamelen == 1) result in "" strings, which is confusing too. 2007-07-11 Jakub Jelinek <jakub@redhat.com> [BZ #4776] * elf/dl-load.c (_dl_rtld_di_serinfo): Output / in LD_LIBRARY_PATH, RPATH etc. as "/" rather than "", don't segfault on empty paths, instead output ".". * dlfcn/Makefile (distribute): Add glreflib3.c. (module-names): Add glreflib3. ($(objpfx)tst-dlinfo.out): Depend on glreflib3.so rather than glreflib1.so. (LDFLAGS_glreflib3.so): New. * dlfcn/tst-dlinfo.c (do_test): Load glreflib3.so instead of glreflib1.so. * dlfcn/glreflib3.c: New file. --- libc/elf/dl-load.c.jj 2007-07-03 12:36:59.000000000 +0200 +++ libc/elf/dl-load.c 2007-07-11 13:21:18.000000000 +0200 @@ -2273,14 +2273,17 @@ _dl_rtld_di_serinfo (struct link_map *lo if (counting) { si->dls_cnt++; - si->dls_size += r->dirnamelen; + si->dls_size += r->dirnamelen < 2 ? r->dirnamelen : 2; } else { Dl_serpath *const sp = &si->dls_serpath[idx++]; sp->dls_name = allocptr; - allocptr = __mempcpy (allocptr, - r->dirname, r->dirnamelen - 1); + if (r->dirnamelen < 2) + *allocptr++ = r->dirnamelen ? '/' : '.'; + else + allocptr = __mempcpy (allocptr, + r->dirname, r->dirnamelen - 1); *allocptr++ = '\0'; sp->dls_flags = flags; } --- libc/dlfcn/Makefile.jj 2006-10-31 23:05:28.000000000 +0100 +++ libc/dlfcn/Makefile 2007-07-11 13:12:07.000000000 +0200 @@ -23,7 +23,8 @@ libdl-routines := dlopen dlclose dlsym d dlmopen dlfcn routines := $(patsubst %,s%,$(filter-out dlfcn,$(libdl-routines))) elide-routines.os := $(routines) -distribute := dlopenold.c glreflib1.c glreflib2.c failtestmod.c \ +distribute := dlopenold.c glreflib1.c glreflib2.c glreflib3.c \ + failtestmod.c \ defaultmod1.c defaultmod2.c errmsg1mod.c modatexit.c \ modcxaatexit.c modstatic.c modstatic2.c \ bug-dlsym1-lib1.c bug-dlsym1-lib2.c bug-atexit1-lib.c \ @@ -43,8 +44,8 @@ tests = glrefmain failtest tst-dladdr de bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \ bug-atexit3 tstatexit endif -modules-names = glreflib1 glreflib2 failtestmod defaultmod1 defaultmod2 \ - errmsg1mod modatexit modcxaatexit \ +modules-names = glreflib1 glreflib2 glreflib3 failtestmod defaultmod1 \ + defaultmod2 errmsg1mod modatexit modcxaatexit \ bug-dlsym1-lib1 bug-dlsym1-lib2 bug-atexit1-lib \ bug-atexit2-lib bug-atexit3-lib @@ -83,7 +84,8 @@ $(objpfx)tst-dladdr: $(libdl) $(objpfx)tst-dladdr.out: $(objpfx)glreflib1.so $(objpfx)tst-dlinfo: $(libdl) -$(objpfx)tst-dlinfo.out: $(objpfx)glreflib1.so +$(objpfx)tst-dlinfo.out: $(objpfx)glreflib3.so +LDFLAGS-glreflib3.so = -Wl,-rpath,: LDFLAGS-default = $(LDFLAGS-rdynamic) $(objpfx)default: $(libdl) $(objpfx)defaultmod1.so $(objpfx)defaultmod2.so --- libc/dlfcn/tst-dlinfo.c.jj 2003-03-16 00:14:48.000000000 +0100 +++ libc/dlfcn/tst-dlinfo.c 2007-07-11 13:13:41.000000000 +0200 @@ -29,7 +29,7 @@ do_test (void) { int status = 0; - void *handle = dlopen ("glreflib1.so", RTLD_NOW); + void *handle = dlopen ("glreflib3.so", RTLD_NOW); if (handle == NULL) error (EXIT_FAILURE, 0, "cannot load: glreflib1.so: %s", dlerror ()); --- libc/dlfcn/glreflib3.c.jj 2007-07-11 13:10:12.000000000 +0200 +++ libc/dlfcn/glreflib3.c 2007-07-11 13:10:06.000000000 +0200 @@ -0,0 +1 @@ +#include "glreflib1.c" Jakub
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |