Overview
| Artifact ID: | 804746f45f0715a1bd91af956181384e27d97ce1 |
|---|---|
| Ticket: | 1967630fffffffffffffffffffffffffffffffff
tclLoadDl.c dlerror() is not thread safe |
| User & Date: | georgeps on 2008-05-20 04:15:19 |
Changes
- assignee changed to: "kennykb"
- cmimetype changed to: "text/plain"
- comment changed to:
According to the standard for dlerror(), it's not required to be thread-safe. http://www.opengroup.org/onlinepubs/009695399/functions/dlerror.html I also checked several open source libc. NetBSD and OpenBSD don't use thread-specific storage for dlerror messages, but the GNU/Linux glibc does. Attached is a patch to fix the problem. It drains the dlerror() first after entering the critical region. The Linux usage suggested is slightly different than what BSD seems to suggest. The glibc dlsym manual suggests using dlerror to indicate the success or failure of a dlsym(), rather than NULL from the return of dlsym(), because apparently dlsym() can return 0/NULL and still have succeeded (with some symbols). So the logic should probably be changed further based on what the glibc docs say. This is the example taken from the manual for dlsym: dlerror(); /* Clear any existing error */ cosine = dlsym(handle, "cos"); if ((error = dlerror()) != NULL) ... I also added error handling to TclpFindSymbol(). It appears to be unfinished prior to this, or the usage expectations of it have changed, because in the HEAD it doesn't use the interp argument to report an error like the (outdated?) comments state.
- foundin changed to: "obsolete: 8.6a0"
- is_private changed to: "0"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "georgeps"
- subsystem changed to: "40. Dynamic Loading"
- title changed to: "tclLoadDl.c dlerror() is not thread safe"
- type changed to: "Bug"