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
This commit is contained in:
parent
af32c4196f
commit
6014c8de1d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=220004
@ -1633,12 +1633,9 @@ load_object(const char *name, const Obj_Entry *refobj, int flags)
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user