diff options
author | David Brazdil <dbrazdil@google.com> | 2018-12-01 17:30:10 +0000 |
---|---|---|
committer | David Brazdil <dbrazdil@google.com> | 2018-12-03 19:03:43 +0000 |
commit | 1ba63c8bf85c1dfcc8cf2cb9c6402fee43342877 (patch) | |
tree | adaa71bd6f9df028cbf94cd1fbbc4dcfb3d81382 | |
parent | 54be7bfba3e3efe021e70299e2fd6d62c1aef813 (diff) |
Add fields to ClassExt to store pre-redefine DexFile pointer
Hidden API access checks refer to the dex file of a class to read
the access flags of a given method/field. The pointer to the dex
file is lost when the class is redefined with JVMTI. Add two fields
to ClassExt which will preserve the DexFile pointer and ClassDef
index of the redefined class.
Bug: 119688837
Test: m test-art
Change-Id: I4808a9bd9f9d29849a342355de6369fbce969b87
-rw-r--r-- | libart/src/main/java/dalvik/system/ClassExt.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libart/src/main/java/dalvik/system/ClassExt.java b/libart/src/main/java/dalvik/system/ClassExt.java index 9c9fa7af43..9180d96c38 100644 --- a/libart/src/main/java/dalvik/system/ClassExt.java +++ b/libart/src/main/java/dalvik/system/ClassExt.java @@ -71,6 +71,31 @@ public final class ClassExt { private Object verifyError; /** + * If set, native pointer to the initial, pre-redefine, dex file associated with the related + * class. This is different from the {@code originalDexFile} which is the pre-retransform dex + * file, i.e. could contain the bytes of the dex file provided during redefine. + * + * It is enough to store the native pointer because the pre-redefine dex file is either part + * of boot classpath or it is being kept alive by its class loader. Class loaders always keep + * dex files alive even if all their classes have been redefined. + * + * Needed in order to preserve access to dex-level hiddenapi flags after JVMTI redefine. + * + * This field is a logical part of the 'Class' type. + */ + private long preRedefineDexFilePtr; + + /** + * ClassDef index of the related class in the pre-redefine dex file. Set together with + * {@code preRedefineDexFilePtr}. + * + * Needed in order to preserve access to dex-level hiddenapi flags after JVMTI redefine. + * + * This field is a logical part of the 'Class' type. + */ + private int preRedefineClassDefIndex; + + /** * Private constructor. * * Only created by the runtime. |