Mercurial > hg > graal-jvmci-8
comparison src/share/vm/prims/jvmtiEnvBase.cpp @ 611:2f716c0acb64
6567360: 3/4 SIGBUS in jvmti RawMonitor magic check for unaligned bad monitor pointer
Summary: Change JvmtiEnvBase::is_valid() and JvmtiRawMonitor::is_valid() to fetch the _magic fields via Bytes::get_native_u[248]().
Reviewed-by: coleenp, swamyv
author | dcubed |
---|---|
date | Mon, 02 Mar 2009 14:05:07 -0700 |
parents | ea20d7ce26b0 |
children | b109e761e927 |
comparison
equal
deleted
inserted
replaced
610:70998f2e05ef | 611:2f716c0acb64 |
---|---|
89 } | 89 } |
90 | 90 |
91 if (_globally_initialized == false) { | 91 if (_globally_initialized == false) { |
92 globally_initialize(); | 92 globally_initialize(); |
93 } | 93 } |
94 } | |
95 | |
96 | |
97 bool | |
98 JvmtiEnvBase::is_valid() { | |
99 jint value = 0; | |
100 | |
101 // This object might not be a JvmtiEnvBase so we can't assume | |
102 // the _magic field is properly aligned. Get the value in a safe | |
103 // way and then check against JVMTI_MAGIC. | |
104 | |
105 switch (sizeof(_magic)) { | |
106 case 2: | |
107 value = Bytes::get_native_u2((address)&_magic); | |
108 break; | |
109 | |
110 case 4: | |
111 value = Bytes::get_native_u4((address)&_magic); | |
112 break; | |
113 | |
114 case 8: | |
115 value = Bytes::get_native_u8((address)&_magic); | |
116 break; | |
117 | |
118 default: | |
119 guarantee(false, "_magic field is an unexpected size"); | |
120 } | |
121 | |
122 return value == JVMTI_MAGIC; | |
94 } | 123 } |
95 | 124 |
96 | 125 |
97 JvmtiEnvBase::JvmtiEnvBase() : _env_event_enable() { | 126 JvmtiEnvBase::JvmtiEnvBase() : _env_event_enable() { |
98 _env_local_storage = NULL; | 127 _env_local_storage = NULL; |