diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-05-22 14:43:37 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-05-22 14:43:37 -0700 |
commit | a6e7f0872c42009ecbee82d7fbe452deef9ae65b (patch) | |
tree | 1ba6d026f6c9a47b9961c62511ab47c6d69314dd /runtime/thread.h | |
parent | 697726d42eaf804a1124c25dec58c2b0013a30e9 (diff) | |
download | art-a6e7f0872c42009ecbee82d7fbe452deef9ae65b.tar.gz art-a6e7f0872c42009ecbee82d7fbe452deef9ae65b.tar.bz2 art-a6e7f0872c42009ecbee82d7fbe452deef9ae65b.zip |
Move SetMonitorEnterObject outside of blocked thread state change.
Race condition:
Thread is suspended in monitor kBlocked, GC decides to run the
checkpoint on it. The GC sees that the object is non null, and goes
to mark it, but then the thread does SetMonitorObject(nullptr).
Which causes a null object to be marked.
Change-Id: Ie8a5074112947ec07d01ccb813ca2c1bb9ac7066
Diffstat (limited to 'runtime/thread.h')
-rw-r--r-- | runtime/thread.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/thread.h b/runtime/thread.h index de054eec4f..9a7cb486d8 100644 --- a/runtime/thread.h +++ b/runtime/thread.h @@ -396,11 +396,11 @@ class Thread { // Convert a jobject into a Object* mirror::Object* DecodeJObject(jobject obj) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::Object* GetMonitorEnterObject() const { + mirror::Object* GetMonitorEnterObject() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return tlsPtr_.monitor_enter_object; } - void SetMonitorEnterObject(mirror::Object* obj) { + void SetMonitorEnterObject(mirror::Object* obj) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { tlsPtr_.monitor_enter_object = obj; } |