mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8168797: do not load any archived classes from a patched module
Add new runtime shared class visibility check to ensure shared classes from patched module are not loaded at runtime. Reviewed-by: acorn, ccheung, hseigel, iklam, lfoltan
This commit is contained in:
parent
a601028e0f
commit
bae7bbd382
9 changed files with 31 additions and 210 deletions
|
@ -1231,6 +1231,8 @@ instanceKlassHandle SystemDictionary::load_shared_class(
|
|||
bool SystemDictionary::is_shared_class_visible(Symbol* class_name,
|
||||
instanceKlassHandle ik,
|
||||
Handle class_loader, TRAPS) {
|
||||
assert(!ModuleEntryTable::javabase_moduleEntry()->is_patched(),
|
||||
"Cannot use sharing if java.base is patched");
|
||||
ResourceMark rm;
|
||||
int path_index = ik->shared_classpath_index();
|
||||
SharedClassPathEntry* ent =
|
||||
|
@ -1258,6 +1260,12 @@ bool SystemDictionary::is_shared_class_visible(Symbol* class_name,
|
|||
}
|
||||
}
|
||||
|
||||
// If the archived class is from a module that has been patched at runtime,
|
||||
// the class cannot be loaded from the archive.
|
||||
if (mod_entry != NULL && mod_entry->is_patched()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (class_loader.is_null()) {
|
||||
assert(ent != NULL, "Shared class for NULL classloader must have valid SharedClassPathEntry");
|
||||
// The NULL classloader can load archived class originated from the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue