| Anonymous | Login | Signup for a new account | 11-10-2008 10:47 PST |
| Main | My View | View Issues | Change Log | Docs |
| Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
| ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
| 0000358 | [uClibc] Shared Library Support | crash | always | 07-26-05 19:25 | 08-02-05 20:13 | ||||
| Reporter | hassold | View Status | public | ||||||
| Assigned To | uClibc | ||||||||
| Priority | normal | Resolution | fixed | ||||||
| Status | closed | Product Version | 0.9.27 | ||||||
| Summary | 0000358: libdl (dlopen/dlsym) segfault when called from statically linked executable | ||||||||
| Description |
Current (svn) libdl implementation in uClibc (dlopen() and friends) segfault if called from a statically linked executable, since _dl_symbol_tables is implicitly assumed to be non-NULL in dlopen() and dlsym() (which is true for dynamic exes), and dereferenced (while its initial value is NULL when called from a static executable). |
||||||||
| Additional Information |
As a quick hack, I protected three occurences in libdl.c (two in dlopen() and one in dlsym()) where this NULL pointer was dereferenced (see attached patch), and everything *apparently* works again. Another solution may consist in allocating a (eventually blank) dyn_elf structure (and its associative elf_resolve as "dyn" member) to set _dl_symbol_tables with a non-empty value. Calling something like: #if !defined (__LIBDL_SHARED__) _dl_symbol_tables = (struct dyn_elf *) _dl_malloc(sizeof(struct dyn_elf)); _dl_memset(_dl_symbol_tables, 0, sizeof(struct dyn_elf)); _dl_symbol_tables->dyn = _dl_loaded_modules; _dl_symbol_tables->next = NULL; _dl_symbol_tables->dyn = (struct elf_resolve *) _dl_malloc(sizeof(struct elf_resolve)); _dl_memset(_dl_symbol_tables->dyn, 0, sizeof(struct elf_resolve)); #endif prior to any invocation of dlopen(), dlsym(),... also makes dynamic loading from static exes works again. |
||||||||
| Attached Files |
|
||||||||
|
|
|||||||||
Notes |
|
|
(0000350) jocke 07-27-05 06:08 |
Fixed as suggested in the patch. The alternative fix is probably how libdl should work in the future, but libdl/ld.so needs more work first. |
| Copyright © 2000 - 2006 Mantis Group |