Mercurial > hg > graal-compiler
comparison src/share/vm/prims/jvmtiImpl.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 | a61af66fc99e |
children | c18cbe5936b8 |
comparison
equal
deleted
inserted
replaced
610:70998f2e05ef | 611:2f716c0acb64 |
---|---|
236 #endif | 236 #endif |
237 _magic = 0; | 237 _magic = 0; |
238 } | 238 } |
239 | 239 |
240 | 240 |
241 bool | |
242 JvmtiRawMonitor::is_valid() { | |
243 int value = 0; | |
244 | |
245 // This object might not be a JvmtiRawMonitor so we can't assume | |
246 // the _magic field is properly aligned. Get the value in a safe | |
247 // way and then check against JVMTI_RM_MAGIC. | |
248 | |
249 switch (sizeof(_magic)) { | |
250 case 2: | |
251 value = Bytes::get_native_u2((address)&_magic); | |
252 break; | |
253 | |
254 case 4: | |
255 value = Bytes::get_native_u4((address)&_magic); | |
256 break; | |
257 | |
258 case 8: | |
259 value = Bytes::get_native_u8((address)&_magic); | |
260 break; | |
261 | |
262 default: | |
263 guarantee(false, "_magic field is an unexpected size"); | |
264 } | |
265 | |
266 return value == JVMTI_RM_MAGIC; | |
267 } | |
268 | |
269 | |
241 // | 270 // |
242 // class JvmtiBreakpoint | 271 // class JvmtiBreakpoint |
243 // | 272 // |
244 | 273 |
245 JvmtiBreakpoint::JvmtiBreakpoint() { | 274 JvmtiBreakpoint::JvmtiBreakpoint() { |