summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-04-09 23:39:07 +0000
committerriastradh <riastradh@NetBSD.org>2022-04-09 23:39:07 +0000
commit2b06bbc6767a60a2865981fe3eed60641a08f625 (patch)
tree380489de1ac56afa4348f5219254f80da0825363 /libexec
parenta046c0aace19389142612e06ce709b8685044364 (diff)
rtld: Convert membar_exit/enter to membar_release/acquire.
These are basic CAS-based locking primitives needing release and acquire semantics, nothing fancy here -- except the membar_sync parts which are questionable but not relevant to the present audit.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ld.elf_so/rtld.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libexec/ld.elf_so/rtld.c b/libexec/ld.elf_so/rtld.c
index 59ed3c4530b..a9171d626aa 100644
--- a/libexec/ld.elf_so/rtld.c
+++ b/libexec/ld.elf_so/rtld.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rtld.c,v 1.210 2021/12/04 14:39:08 skrll Exp $ */
+/* $NetBSD: rtld.c,v 1.211 2022/04/09 23:39:07 riastradh Exp $ */
/*
* Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.210 2021/12/04 14:39:08 skrll Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.211 2022/04/09 23:39:07 riastradh Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -1682,7 +1682,7 @@ _rtld_shared_enter(void)
/* Yes, so increment use counter */
if (atomic_cas_uint(&_rtld_mutex, cur, cur + 1) != cur)
continue;
- membar_enter();
+ membar_acquire();
return;
}
/*
@@ -1728,7 +1728,7 @@ _rtld_shared_exit(void)
* Wakeup LWPs waiting for an exclusive lock if this is the last
* LWP on the shared lock.
*/
- membar_exit();
+ membar_release();
if (atomic_dec_uint_nv(&_rtld_mutex))
return;
membar_sync();
@@ -1750,7 +1750,7 @@ _rtld_exclusive_enter(sigset_t *mask)
for (;;) {
if (atomic_cas_uint(&_rtld_mutex, 0, locked_value) == 0) {
- membar_enter();
+ membar_acquire();
break;
}
waiter = atomic_swap_uint(&_rtld_waiter_exclusive, self);
@@ -1774,7 +1774,7 @@ _rtld_exclusive_exit(sigset_t *mask)
{
lwpid_t waiter;
- membar_exit();
+ membar_release();
_rtld_mutex = 0;
membar_sync();
if ((waiter = _rtld_waiter_exclusive) != 0)