JDK-5063021 : protection domain not used in redefine classes
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2004-06-15
  • Updated: 2005-03-18
  • Resolved: 2005-03-18
Related Reports
Duplicate :  
Description
Found by code inspections, not yet tested.  The following code creates the new version of the class, but does not set the protection_domain.  One would think that it should be copied from the old class, just like class_loader it.  It would appear that there is at least one bug caused by this (again just by inspection), the ClassFileParser sends the ClassFileLoadHook event, this is sent with the passed in (unset) protection domain ---

    // Parse the stream.
    Handle k_loader_h(THREAD, k_h->class_loader());
    Handle protection_domain;
    // Set redefined class handle in JvmtiThreadState class.
    // This redefined class is sent to agent event handler for class file
    // load hook event.
    state->set_class_being_redefined(&k_h);

    klassOop k = SystemDictionary::parse_stream(k_name, 
                                                k_loader_h, 
                                                protection_domain,
                                                &st,
                                                THREAD);


The protection_domain is not copied from the new class version so should not impact the actual protection_domain of the class.


Comments
EVALUATION This should be fixed but too late for tiger. ###@###.### 2004-06-22 This issue was addressed in a big batch of JFluid/RedefineClasses fixes that were putback into Tiger-Update4-B02 and Mustang-B26. Here is the delta comment from src/share/vm/prims/jvmtiRedefineClasses.cpp: D 1.21.2.5 05/02/01 21:11:27 dcubed 53 52 00052/00019/01710 MRs: COMMENTS: 5088035, 5109602 code reviews - scratch_class should use same protection domain as the_class. Add tracing for exceptions. Verify caller's bytecodes before CP merge and optionally verify again after CP merge; post CP merge failure returns INTERNAL error instead of FAILS_VERIFICATION. Do compare_class_versions() before CP merge and after verification. ObjectLocker should not be needed since scratch_class isn't exposed. Add StressLdcRewrite option to force ldc -> ldc_w rewriting. I am closing this bug as a duplicate of 5088035. ###@###.### 2005-03-18 17:45:44 GMT
18-03-2005