< prev index next >

src/share/vm/classfile/verifier.cpp

Print this page

        

*** 123,133 **** st->print_cr("Verification for %s failed", klassName); } st->print_cr("End class verification for: %s", klassName); } ! bool Verifier::verify(instanceKlassHandle klass, Verifier::Mode mode, bool should_verify_class, TRAPS) { HandleMark hm(THREAD); ResourceMark rm(THREAD); // Eagerly allocate the identity hash code for a klass. This is a fallout // from 6320749 and 8059924: hash code generator is not supposed to be called --- 123,133 ---- st->print_cr("Verification for %s failed", klassName); } st->print_cr("End class verification for: %s", klassName); } ! bool Verifier::verify(InstanceKlass* klass, Verifier::Mode mode, bool should_verify_class, TRAPS) { HandleMark hm(THREAD); ResourceMark rm(THREAD); // Eagerly allocate the identity hash code for a klass. This is a fallout // from 6320749 and 8059924: hash code generator is not supposed to be called
*** 201,217 **** return false; // use the existing exception } else if (exception_name == NULL) { return true; // verifcation succeeded } else { // VerifyError or ClassFormatError to be created and thrown ResourceMark rm(THREAD); ! instanceKlassHandle kls = SystemDictionary::resolve_or_fail(exception_name, true, CHECK_false); if (log_is_enabled(Debug, class, resolve)) { ! Verifier::trace_class_resolution(kls(), klass()); } ! while (!kls.is_null()) { if (kls == klass) { // If the class being verified is the exception we're creating // or one of it's superclasses, we're in trouble and are going // to infinitely recurse when we try to initialize the exception. // So bail out here by throwing the preallocated VM error. --- 201,217 ---- return false; // use the existing exception } else if (exception_name == NULL) { return true; // verifcation succeeded } else { // VerifyError or ClassFormatError to be created and thrown ResourceMark rm(THREAD); ! Klass* kls = SystemDictionary::resolve_or_fail(exception_name, true, CHECK_false); if (log_is_enabled(Debug, class, resolve)) { ! Verifier::trace_class_resolution(kls, klass); } ! while (kls != NULL) { if (kls == klass) { // If the class being verified is the exception we're creating // or one of it's superclasses, we're in trouble and are going // to infinitely recurse when we try to initialize the exception. // So bail out here by throwing the preallocated VM error.
*** 222,232 **** message_buffer[message_buffer_len - 1] = '\0'; // just to be sure THROW_MSG_(exception_name, exception_message, false); } } ! bool Verifier::is_eligible_for_verification(instanceKlassHandle klass, bool should_verify_class) { Symbol* name = klass->name(); Klass* refl_magic_klass = SystemDictionary::reflect_MagicAccessorImpl_klass(); bool is_reflect = refl_magic_klass != NULL && klass->is_subtype_of(refl_magic_klass); --- 222,232 ---- message_buffer[message_buffer_len - 1] = '\0'; // just to be sure THROW_MSG_(exception_name, exception_message, false); } } ! bool Verifier::is_eligible_for_verification(InstanceKlass* klass, bool should_verify_class) { Symbol* name = klass->name(); Klass* refl_magic_klass = SystemDictionary::reflect_MagicAccessorImpl_klass(); bool is_reflect = refl_magic_klass != NULL && klass->is_subtype_of(refl_magic_klass);
*** 241,251 **** // Can not verify the bytecodes for shared classes because they have // already been rewritten to contain constant pool cache indices, // which the verifier can't understand. // Shared classes shouldn't have stackmaps either. ! !klass()->is_shared() && // As of the fix for 4486457 we disable verification for all of the // dynamically-generated bytecodes associated with the 1.4 // reflection implementation, not just those associated with // jdk/internal/reflect/SerializationConstructorAccessor. --- 241,251 ---- // Can not verify the bytecodes for shared classes because they have // already been rewritten to contain constant pool cache indices, // which the verifier can't understand. // Shared classes shouldn't have stackmaps either. ! !klass->is_shared() && // As of the fix for 4486457 we disable verification for all of the // dynamically-generated bytecodes associated with the 1.4 // reflection implementation, not just those associated with // jdk/internal/reflect/SerializationConstructorAccessor.
*** 254,264 **** // Also for lambda generated code, gte jdk8 (!is_reflect)); } Symbol* Verifier::inference_verify( ! instanceKlassHandle klass, char* message, size_t message_len, TRAPS) { JavaThread* thread = (JavaThread*)THREAD; JNIEnv *env = thread->jni_environment(); void* verify_func = verify_byte_codes_fn(); --- 254,264 ---- // Also for lambda generated code, gte jdk8 (!is_reflect)); } Symbol* Verifier::inference_verify( ! InstanceKlass* klass, char* message, size_t message_len, TRAPS) { JavaThread* thread = (JavaThread*)THREAD; JNIEnv *env = thread->jni_environment(); void* verify_func = verify_byte_codes_fn();
*** 557,567 **** } // Methods in ClassVerifier ClassVerifier::ClassVerifier( ! instanceKlassHandle klass, TRAPS) : _thread(THREAD), _exception_type(NULL), _message(NULL), _klass(klass) { _this_type = VerificationType::reference_type(klass->name()); // Create list to hold symbols in reference area. _symbols = new GrowableArray<Symbol*>(100, 0, NULL); } --- 557,567 ---- } // Methods in ClassVerifier ClassVerifier::ClassVerifier( ! InstanceKlass* klass, TRAPS) : _thread(THREAD), _exception_type(NULL), _message(NULL), _klass(klass) { _this_type = VerificationType::reference_type(klass->name()); // Create list to hold symbols in reference area. _symbols = new GrowableArray<Symbol*>(100, 0, NULL); }
*** 1999,2015 **** Klass* kls = SystemDictionary::resolve_or_fail( name, Handle(THREAD, loader), Handle(THREAD, protection_domain), true, THREAD); if (log_is_enabled(Debug, class, resolve)) { ! instanceKlassHandle cur_class = current_class(); ! Verifier::trace_class_resolution(kls, cur_class()); } return kls; } ! bool ClassVerifier::is_protected_access(instanceKlassHandle this_class, Klass* target_class, Symbol* field_name, Symbol* field_sig, bool is_method) { NoSafepointVerifier nosafepoint; --- 1999,2015 ---- Klass* kls = SystemDictionary::resolve_or_fail( name, Handle(THREAD, loader), Handle(THREAD, protection_domain), true, THREAD); if (log_is_enabled(Debug, class, resolve)) { ! InstanceKlass* cur_class = InstanceKlass::cast(current_class()); ! Verifier::trace_class_resolution(kls, cur_class); } return kls; } ! bool ClassVerifier::is_protected_access(InstanceKlass* this_class, Klass* target_class, Symbol* field_name, Symbol* field_sig, bool is_method) { NoSafepointVerifier nosafepoint;
*** 2168,2178 **** } NOT_PRODUCT(aligned_bcp = NULL); // no longer valid at this point } bool ClassVerifier::name_in_supers( ! Symbol* ref_name, instanceKlassHandle current) { Klass* super = current->super(); while (super != NULL) { if (super->name() == ref_name) { return true; } --- 2168,2178 ---- } NOT_PRODUCT(aligned_bcp = NULL); // no longer valid at this point } bool ClassVerifier::name_in_supers( ! Symbol* ref_name, InstanceKlass* current) { Klass* super = current->super(); while (super != NULL) { if (super->name() == ref_name) { return true; }
*** 2598,2609 **** vmSymbols::object_initializer_name(), cp->signature_ref_at(bcs->get_index_u2()), Klass::find_overpass); // Do nothing if method is not found. Let resolution detect the error. if (m != NULL) { ! instanceKlassHandle mh(THREAD, m->method_holder()); ! if (m->is_protected() && !mh->is_same_class_package(_klass())) { bool assignable = current_type().is_assignable_from( objectref_type, this, true, CHECK_VERIFY(this)); if (!assignable) { verify_error(ErrorContext::bad_type(bci, TypeOrigin::cp(new_class_index, objectref_type), --- 2598,2609 ---- vmSymbols::object_initializer_name(), cp->signature_ref_at(bcs->get_index_u2()), Klass::find_overpass); // Do nothing if method is not found. Let resolution detect the error. if (m != NULL) { ! InstanceKlass* mh = m->method_holder(); ! if (m->is_protected() && !mh->is_same_class_package(_klass)) { bool assignable = current_type().is_assignable_from( objectref_type, this, true, CHECK_VERIFY(this)); if (!assignable) { verify_error(ErrorContext::bad_type(bci, TypeOrigin::cp(new_class_index, objectref_type),
*** 2629,2639 **** return; } } bool ClassVerifier::is_same_or_direct_interface( ! instanceKlassHandle klass, VerificationType klass_type, VerificationType ref_class_type) { if (ref_class_type.equals(klass_type)) return true; Array<Klass*>* local_interfaces = klass->local_interfaces(); if (local_interfaces != NULL) { --- 2629,2639 ---- return; } } bool ClassVerifier::is_same_or_direct_interface( ! InstanceKlass* klass, VerificationType klass_type, VerificationType ref_class_type) { if (ref_class_type.equals(klass_type)) return true; Array<Klass*>* local_interfaces = klass->local_interfaces(); if (local_interfaces != NULL) {
< prev index next >