413 MutexLocker mu(SystemDictionary_lock, THREAD); 414 placeholders()->find_and_remove(p_index, p_hash, child_name, loader_data, PlaceholderTable::LOAD_SUPER, THREAD); 415 SystemDictionary_lock->notify_all(); 416 } 417 if (HAS_PENDING_EXCEPTION || superk_h() == NULL) { 418 // can null superk 419 superk_h = KlassHandle(THREAD, handle_resolution_exception(class_name, true, superk_h, THREAD)); 420 } 421 422 return superk_h(); 423 } 424 425 void SystemDictionary::validate_protection_domain(instanceKlassHandle klass, 426 Handle class_loader, 427 Handle protection_domain, 428 TRAPS) { 429 if(!has_checkPackageAccess()) return; 430 431 // Now we have to call back to java to check if the initating class has access 432 JavaValue result(T_VOID); 433 if (TraceProtectionDomainVerification) { 434 // Print out trace information 435 tty->print_cr("Checking package access"); 436 tty->print(" - class loader: "); class_loader()->print_value_on(tty); tty->cr(); 437 tty->print(" - protection domain: "); protection_domain()->print_value_on(tty); tty->cr(); 438 tty->print(" - loading: "); klass()->print_value_on(tty); tty->cr(); 439 } 440 441 KlassHandle system_loader(THREAD, SystemDictionary::ClassLoader_klass()); 442 JavaCalls::call_special(&result, 443 class_loader, 444 system_loader, 445 vmSymbols::checkPackageAccess_name(), 446 vmSymbols::class_protectiondomain_signature(), 447 Handle(THREAD, klass->java_mirror()), 448 protection_domain, 449 THREAD); 450 451 if (TraceProtectionDomainVerification) { 452 if (HAS_PENDING_EXCEPTION) { 453 tty->print_cr(" -> DENIED !!!!!!!!!!!!!!!!!!!!!"); 454 } else { 455 tty->print_cr(" -> granted"); 456 } 457 tty->cr(); 458 } 459 460 if (HAS_PENDING_EXCEPTION) return; 461 462 // If no exception has been thrown, we have validated the protection domain 463 // Insert the protection domain of the initiating class into the set. 464 { 465 // We recalculate the entry here -- we've called out to java since 466 // the last time it was calculated. 467 ClassLoaderData* loader_data = class_loader_data(class_loader); 468 469 Symbol* kn = klass->name(); 470 unsigned int d_hash = dictionary()->compute_hash(kn, loader_data); 471 int d_index = dictionary()->hash_to_index(d_hash); 472 473 MutexLocker mu(SystemDictionary_lock, THREAD); 474 { 475 // Note that we have an entry, and entries can be deleted only during GC, 476 // so we cannot allow GC to occur while we're holding this entry. 477 | 413 MutexLocker mu(SystemDictionary_lock, THREAD); 414 placeholders()->find_and_remove(p_index, p_hash, child_name, loader_data, PlaceholderTable::LOAD_SUPER, THREAD); 415 SystemDictionary_lock->notify_all(); 416 } 417 if (HAS_PENDING_EXCEPTION || superk_h() == NULL) { 418 // can null superk 419 superk_h = KlassHandle(THREAD, handle_resolution_exception(class_name, true, superk_h, THREAD)); 420 } 421 422 return superk_h(); 423 } 424 425 void SystemDictionary::validate_protection_domain(instanceKlassHandle klass, 426 Handle class_loader, 427 Handle protection_domain, 428 TRAPS) { 429 if(!has_checkPackageAccess()) return; 430 431 // Now we have to call back to java to check if the initating class has access 432 JavaValue result(T_VOID); 433 if (log_is_enabled(Debug, protectiondomain)) { 434 ResourceMark rm; 435 // Print out trace information 436 outputStream* log = LogHandle(protectiondomain)::debug_stream(); 437 log->print_cr("Checking package access"); 438 log->print(" - class loader: "); class_loader()->print_value_on(log); log->cr(); 439 log->print(" - protection domain: "); protection_domain()->print_value_on(log); log->cr(); 440 log->print(" - loading: "); klass()->print_value_on(log); log->cr(); 441 } 442 443 KlassHandle system_loader(THREAD, SystemDictionary::ClassLoader_klass()); 444 JavaCalls::call_special(&result, 445 class_loader, 446 system_loader, 447 vmSymbols::checkPackageAccess_name(), 448 vmSymbols::class_protectiondomain_signature(), 449 Handle(THREAD, klass->java_mirror()), 450 protection_domain, 451 THREAD); 452 453 if (log_is_enabled(Debug, protectiondomain)) { 454 ResourceMark rm; 455 outputStream* log = LogHandle(protectiondomain)::debug_stream(); 456 if (HAS_PENDING_EXCEPTION) { 457 log->print_cr(" -> DENIED !!!!!!!!!!!!!!!!!!!!!"); 458 } else { 459 log->print_cr(" -> granted"); 460 } 461 log->cr(); 462 } 463 464 if (HAS_PENDING_EXCEPTION) return; 465 466 // If no exception has been thrown, we have validated the protection domain 467 // Insert the protection domain of the initiating class into the set. 468 { 469 // We recalculate the entry here -- we've called out to java since 470 // the last time it was calculated. 471 ClassLoaderData* loader_data = class_loader_data(class_loader); 472 473 Symbol* kn = klass->name(); 474 unsigned int d_hash = dictionary()->compute_hash(kn, loader_data); 475 int d_index = dictionary()->hash_to_index(d_hash); 476 477 MutexLocker mu(SystemDictionary_lock, THREAD); 478 { 479 // Note that we have an entry, and entries can be deleted only during GC, 480 // so we cannot allow GC to occur while we're holding this entry. 481 |