This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug dynamic-link/14989] dlerror() returns garbage
- From: "neleai at seznam dot cz" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Fri, 11 Oct 2013 19:42:03 +0000
- Subject: [Bug dynamic-link/14989] dlerror() returns garbage
- Auto-submitted: auto-generated
- References: <bug-14989-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=14989
Ondrej Bilka <neleai at seznam dot cz> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |neleai at seznam dot cz
Resolution|--- |INVALID
--- Comment #7 from Ondrej Bilka <neleai at seznam dot cz> ---
This does not change that libraries can be closed unlimited number of times and
requiring to keep all names would be equivalent to resource leak. There is
currently no quarantee that detailed error will contain accurate name. Keeping
a limited history would be a enchancement.
As for compilance a dlsym already does a linear search, see elf/dl_open.c
function _dl_find_dso_for_object.
A requirement of returning NULL complicates this, it implies that dlsym/dlclose
need to be thread-safe as there would be race. Also on 32bit systems this
condition is impossible to fulfill after 1+1<<32 dlopens/dlcloses,
Barring locking a implementation is matter of choosing correct data structure
which is in our case perfect hash table. As can choose keys arbitrarily we
could just pick first free position and increment last key.
dso **__dso_ary;
int __logsize;
dlsym(long x){
long hash = (x<<logsize)>>logsize;
dso *d = __dso_ary[hash];
if (d->key != x)
return NULL;
}
dlopen(...){
long hash=free_pos();
dso *d = __dso_ary[hash];
d->key = hash + (d->last_key + 1) % (1<<logsize);
long x = d->key;
}
--
You are receiving this mail because:
You are on the CC list for the bug.