svn commit: r220004 - head/libexec/rtld-elf
Andriy Gapon
avg at FreeBSD.org
Fri Mar 25 18:23:11 UTC 2011
Author: avg
Date: Fri Mar 25 18:23:10 2011
New Revision: 220004
URL: http://svn.freebsd.org/changeset/base/220004
Log:
rtld: eliminate double call to close(2) that may occur in load_object
The second close(2) call resulted in heisenbugs in some multi-threaded
applications where e.g. dlopen(3) call in one thread could close a file
descriptor for a file having been opened in other thread concurrently.
My litmus test for this issue was an openoffice.org build.
Reviewed by: jhb
MFC after: 2 weeks
Modified:
head/libexec/rtld-elf/rtld.c
Modified: head/libexec/rtld-elf/rtld.c
==============================================================================
--- head/libexec/rtld-elf/rtld.c Fri Mar 25 18:16:49 2011 (r220003)
+++ head/libexec/rtld-elf/rtld.c Fri Mar 25 18:23:10 2011 (r220004)
@@ -1633,12 +1633,9 @@ load_object(const char *name, const Obj_
free(path);
return NULL;
}
- for (obj = obj_list->next; obj != NULL; obj = obj->next) {
- if (obj->ino == sb.st_ino && obj->dev == sb.st_dev) {
- close(fd);
+ for (obj = obj_list->next; obj != NULL; obj = obj->next)
+ if (obj->ino == sb.st_ino && obj->dev == sb.st_dev)
break;
- }
- }
if (obj != NULL) {
object_add_name(obj, name);
free(path);
More information about the svn-src-head
mailing list