Prevent ArtMethod clearing race
There was race condition where the GC would be visiting the methods
of a class while the class linker overwrote the contents with 0xFE
when copying to a new array.
Since the GC is holding the class table lock at this time, we can
use this lock in the class linker to prevent the race.
Bug: 28699001
(cherry picked from commit 10c5f56423feaf3eadb3d4c09c61d2b998404162)
Change-Id: I5ddca93106cb8e48962cf44e5ce434c45e05cd0c
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 1845f44..9b5ca0e 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -1024,7 +1024,7 @@
// Returns null if not found.
ClassTable* ClassTableForClassLoader(mirror::ClassLoader* class_loader)
- SHARED_REQUIRES(Locks::mutator_lock_, Locks::classlinker_classes_lock_);
+ SHARED_REQUIRES(Locks::mutator_lock_);
// Insert a new class table if not found.
ClassTable* InsertClassTableForClassLoader(mirror::ClassLoader* class_loader)