summaryrefslogtreecommitdiff
path: root/runtime/plugin.cc
diff options
context:
space:
mode:
author Alex Light <allight@google.com> 2019-09-11 09:48:51 -0700
committer Treehugger Robot <treehugger-gerrit@google.com> 2019-09-11 19:41:04 +0000
commit3b08bcce2d9c32e469ce11d247bed46439977cac (patch)
treecc719c563515446f647c01fbf170302ca349996c /runtime/plugin.cc
parent0054aa59c50374751cc65e8de31a1d813912e67d (diff)
Fixup inconsistency due to change in Plugin loading requirements.
Some time ago plugin loading was changed to always occur with the thread in kNative (see commit 3a256b1d3689). This adds asserts that to plugin loading that the state is correct, fixes an incorrect lock-annotation and fixes a test plugin that was missed. Test: ./test.py --host Test: atest CtsJdwpTunnelHostTestCases Test: atest CtsJvmtiAttachingHostTestCases Change-Id: Ib27ab58e9a357fa308a33da13a86e8d65575e9f4
Diffstat (limited to 'runtime/plugin.cc')
-rw-r--r--runtime/plugin.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/runtime/plugin.cc b/runtime/plugin.cc
index 6f1c5179f9..6b9e0081cf 100644
--- a/runtime/plugin.cc
+++ b/runtime/plugin.cc
@@ -19,6 +19,9 @@
#include <dlfcn.h>
#include "android-base/stringprintf.h"
+#include "base/locks.h"
+#include "base/mutex.h"
+#include "thread-current-inl.h"
namespace art {
@@ -32,6 +35,7 @@ Plugin::Plugin(const Plugin& other) : library_(other.library_), dlopen_handle_(n
}
bool Plugin::Load(/*out*/std::string* error_msg) {
+ Locks::mutator_lock_->AssertNotHeld(Thread::Current());
DCHECK(!IsLoaded());
void* res = dlopen(library_.c_str(), RTLD_LAZY);
if (res == nullptr) {
@@ -55,6 +59,7 @@ bool Plugin::Load(/*out*/std::string* error_msg) {
}
bool Plugin::Unload() {
+ Locks::mutator_lock_->AssertNotHeld(Thread::Current());
DCHECK(IsLoaded());
bool ret = true;
void* handle = dlopen_handle_;