diff options
| author | 2018-12-01 17:54:26 +0000 | |
|---|---|---|
| committer | 2018-12-03 20:19:40 +0000 | |
| commit | 1a6586327d9de6374f9e7ca98d071f2943b03c99 (patch) | |
| tree | 1d118af8f32855ef0036080d5e8a560f14e5e482 /runtime/mirror/class_ext.cc | |
| parent | d378a567a435a80be9ab7eb8bfe0359c1240c0ff (diff) | |
Keep pointer to original DexFile during JVMTI redefine for hiddenapi
JVMTI redefine overwrites the pointer to the class' DexFile which
prevents access checks from reading the hiddenapi flags store. Store
the pointer in ClassExt together with the original ClassDef index
to preserve the access to flags store. Because method/field indices
are still lost, the corresponding dex member is found using string
comparison of member's name and type.
Bug: 119688837
Test: 999-redefine-hiddenapi
Change-Id: Ifdf35668e838869a971233bbaae61851014658b1
Diffstat (limited to 'runtime/mirror/class_ext.cc')
| -rw-r--r-- | runtime/mirror/class_ext.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/runtime/mirror/class_ext.cc b/runtime/mirror/class_ext.cc index 67126307dc..146adc978c 100644 --- a/runtime/mirror/class_ext.cc +++ b/runtime/mirror/class_ext.cc @@ -119,5 +119,17 @@ void ClassExt::SetOriginalDexFile(ObjPtr<Object> bytes) { SetFieldObject<false>(OFFSET_OF_OBJECT_MEMBER(ClassExt, original_dex_file_), bytes); } +void ClassExt::SetPreRedefineClassDefIndex(uint16_t index) { + DCHECK(!Runtime::Current()->IsActiveTransaction()); + SetField32<false>(OFFSET_OF_OBJECT_MEMBER(ClassExt, pre_redefine_class_def_index_), + static_cast<int32_t>(index)); +} + +void ClassExt::SetPreRedefineDexFile(const DexFile* dex_file) { + DCHECK(!Runtime::Current()->IsActiveTransaction()); + SetField64<false>(OFFSET_OF_OBJECT_MEMBER(ClassExt, pre_redefine_dex_file_ptr_), + static_cast<int64_t>(reinterpret_cast<uintptr_t>(dex_file))); +} + } // namespace mirror } // namespace art |