-
Bug
-
Resolution: Fixed
-
P3
-
25
-
b19
During an application's training run, it's possible to inject classes into the built-in platform/app class loaders with reflection calls. Previously, only the names of these classes were recorded in the AOT config file. When the AOT cache is generated, these classes are automatically filtered out.
However, sinceJDK-8348426, these classes are stored as parsed InstanceKlasses in the AOT config file, and will be transferred into the AOT cache.
The new behavior may cause some applications to fail, as they may inject bytecodes that have environment dependencies. For safety, it's better to filter out such injected classes,
Example:
========================
Method m = ClassLoader.class.getDeclaredMethod("defineClass", String.class,
byte[].class, int.class, int.class, ProtectionDomain.class);
m.setAccessible(true);
ProtectionDomain pd = MyApp.class.getProtectionDomain();
ClassLoader appLoader = MyApp.class.getClassLoader();
byte[] data = Files.readAllBytes(Paths.get("ClassNotInJar2.class"));
Class c = (Class)m.invoke(appLoader, "ClassNotInJar2", data, 0, data.length, pd);
==========================
However, since
The new behavior may cause some applications to fail, as they may inject bytecodes that have environment dependencies. For safety, it's better to filter out such injected classes,
Example:
========================
Method m = ClassLoader.class.getDeclaredMethod("defineClass", String.class,
byte[].class, int.class, int.class, ProtectionDomain.class);
m.setAccessible(true);
ProtectionDomain pd = MyApp.class.getProtectionDomain();
ClassLoader appLoader = MyApp.class.getClassLoader();
byte[] data = Files.readAllBytes(Paths.get("ClassNotInJar2.class"));
Class c = (Class)m.invoke(appLoader, "ClassNotInJar2", data, 0, data.length, pd);
==========================
- relates to
-
JDK-8335735 jruby -J-XX:CacheDataStore=jruby.cds crashes due to lack of module support
-
- Open
-
- links to
-
Commit(master) openjdk/jdk/e433fa27
-
Review(master) openjdk/jdk/24046