United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6474243 suspicious jvmti code that uses oop unsafely across GC point
JDK-6474243 : suspicious jvmti code that uses oop unsafely across GC point

Details
Type:
Bug
Submit Date:
2006-09-22
Status:
Resolved
Updated Date:
2010-12-03
Project Name:
JDK
Resolved Date:
2008-12-10
Component:
hotspot
OS:
solaris
Sub-Component:
jvmti
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
hs14 (b09)

Related Reports
Backport:
Backport:

Sub Tasks

Description
from ###@###.###

I was working on the ppc port and I came across some suspicious jvmdi
code so I looked at mustang and I see some suspicious jvmti code. Take a look
at TemplateTable::jvmti_post_field_access() here's the suspicious code:

if (has_tos) {
       // save object pointer before call_VM() clobbers it
         __ mov(Otos_i, Lscratch);
       } else {
         // Load top of stack (do not pop the value off the stack);
         __ ld_ptr(Lesp, Interpreter::expr_offset_in_bytes(0), Otos_i);
       }
       __ verify_oop(Otos_i);
     }
     // Otos_i: object pointer or NULL if static
     // Rcache: cache entry pointer
     __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_field_access),
                Otos_i, Rcache);
     if (!is_static && has_tos) {
       __ mov(Lscratch, Otos_i);  // restore object pointer


It would appear to be hiding an oop in Lscratch. Hope it doesn't move. :-) It also
isn't clear if it really needs to be pushed on the expression stack so that
a gc will have the correct number of items on the stack.

-- 
Steve
Delete comment from another bug.

                                    

Comments
EVALUATION

Summary: oop stored in unsafely in Lscratch noticed by visual inspection will not be updated by GC.

Could cause an intermittent crash in jvmti, fixing for hs14.

Tested by running nsk.jvmti.testlist tests with -XX:+VerifyOops (not bit rotten at the moment, yeah).
                                     
2008-11-24
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-rt/hotspot/rev/b22701a8b88f
                                     
2008-11-24



Hardware and Software, Engineered to Work Together