Module Name:    src
Committed By:   martin
Date:           Tue Aug  1 15:17:44 UTC 2023

Modified Files:
        src/libexec/ld.elf_so [netbsd-9]: rtld.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1690):

        libexec/ld.elf_so/rtld.c: revision 1.213

dlopen(3): Read _rtld_objtail under the lock.


To generate a diff of this commit:
cvs rdiff -u -r1.197.2.5 -r1.197.2.6 src/libexec/ld.elf_so/rtld.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/rtld.c
diff -u src/libexec/ld.elf_so/rtld.c:1.197.2.5 src/libexec/ld.elf_so/rtld.c:1.197.2.6
--- src/libexec/ld.elf_so/rtld.c:1.197.2.5	Sat Apr  1 16:08:05 2023
+++ src/libexec/ld.elf_so/rtld.c	Tue Aug  1 15:17:44 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.c,v 1.197.2.5 2023/04/01 16:08:05 martin Exp $	 */
+/*	$NetBSD: rtld.c,v 1.197.2.6 2023/08/01 15:17:44 martin Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.197.2.5 2023/04/01 16:08:05 martin Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.197.2.6 2023/08/01 15:17:44 martin Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -1024,7 +1024,7 @@ __strong_alias(__dlopen,dlopen)
 void *
 dlopen(const char *name, int mode)
 {
-	Obj_Entry **old_obj_tail = _rtld_objtail;
+	Obj_Entry **old_obj_tail;
 	Obj_Entry *obj = NULL;
 	int flags = _RTLD_DLOPEN;
 	bool nodelete;
@@ -1036,6 +1036,8 @@ dlopen(const char *name, int mode)
 
 	_rtld_exclusive_enter(&mask);
 
+	old_obj_tail = _rtld_objtail;
+
 	flags |= (mode & RTLD_GLOBAL) ? _RTLD_GLOBAL : 0;
 	flags |= (mode & RTLD_NOLOAD) ? _RTLD_NOLOAD : 0;
 

Reply via email to