Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ld.elf_so dlopen(3): Read _rtld_objtail under the lock.



details:   https://anonhg.NetBSD.org/src/rev/13ff76815c1a
branches:  trunk
changeset: 374457:13ff76815c1a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Apr 23 11:53:00 2023 +0000

description:
dlopen(3): Read _rtld_objtail under the lock.

XXX pullup-8
XXX pullup-9
XXX pullup-10

diffstat:

 libexec/ld.elf_so/rtld.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r 40ae64d7397f -r 13ff76815c1a libexec/ld.elf_so/rtld.c
--- a/libexec/ld.elf_so/rtld.c  Sun Apr 23 11:52:43 2023 +0000
+++ b/libexec/ld.elf_so/rtld.c  Sun Apr 23 11:53:00 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtld.c,v 1.212 2022/09/13 10:18:58 riastradh Exp $      */
+/*     $NetBSD: rtld.c,v 1.213 2023/04/23 11:53:00 riastradh Exp $      */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.212 2022/09/13 10:18:58 riastradh Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.213 2023/04/23 11:53:00 riastradh Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -1026,7 +1026,7 @@ dlerror(void)
 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;
@@ -1038,6 +1038,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;
 



Home | Main Index | Thread Index | Old Index