mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 11:34:38 +02:00
6567360: 3/4 SIGBUS in jvmti RawMonitor magic check for unaligned bad monitor pointer
Change JvmtiEnvBase::is_valid() and JvmtiRawMonitor::is_valid() to fetch the _magic fields via Bytes::get_native_u[248](). Reviewed-by: coleenp, swamyv
This commit is contained in:
parent
da3f81559f
commit
8aebf28301
4 changed files with 60 additions and 2 deletions
|
@ -238,6 +238,35 @@ JvmtiRawMonitor::~JvmtiRawMonitor() {
|
|||
}
|
||||
|
||||
|
||||
bool
|
||||
JvmtiRawMonitor::is_valid() {
|
||||
int value = 0;
|
||||
|
||||
// This object might not be a JvmtiRawMonitor so we can't assume
|
||||
// the _magic field is properly aligned. Get the value in a safe
|
||||
// way and then check against JVMTI_RM_MAGIC.
|
||||
|
||||
switch (sizeof(_magic)) {
|
||||
case 2:
|
||||
value = Bytes::get_native_u2((address)&_magic);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
value = Bytes::get_native_u4((address)&_magic);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
value = Bytes::get_native_u8((address)&_magic);
|
||||
break;
|
||||
|
||||
default:
|
||||
guarantee(false, "_magic field is an unexpected size");
|
||||
}
|
||||
|
||||
return value == JVMTI_RM_MAGIC;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// class JvmtiBreakpoint
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue