< prev index next >
src/hotspot/os/aix/porting_aix.cpp
Print this page
rev 51015 : 8207342: error occurred during error reporting (printing register info)
Summary: os::print_location misses a check if the pointer is readable.
Reviewed-by:
*** 140,150 ****
// .. (Note that is_readable_pointer returns true if safefetch stubs are not there yet;
// in that case I try reading the traceback table unsafe - I rather risk secondary crashes in
// error files than not having a callstack.)
#define CHECK_POINTER_READABLE(p) \
! if (!MiscUtils::is_readable_pointer(p)) { \
trcVerbose("pc not readable"); \
return false; \
}
codeptr_t pc2 = (codeptr_t) pc;
--- 140,150 ----
// .. (Note that is_readable_pointer returns true if safefetch stubs are not there yet;
// in that case I try reading the traceback table unsafe - I rather risk secondary crashes in
// error files than not having a callstack.)
#define CHECK_POINTER_READABLE(p) \
! if (!os::is_readable_pointer(p)) { \
trcVerbose("pc not readable"); \
return false; \
}
codeptr_t pc2 = (codeptr_t) pc;
*** 228,238 ****
if (tb->tb.name_present) {
// Copy name from text because it may not be zero terminated.
const short l = MIN2<short>(*((short*)pc2), namelen - 1);
// Be very careful.
int i = 0; char* const p = (char*)pc2 + sizeof(short);
! while (i < l && MiscUtils::is_readable_pointer(p + i)) {
p_name[i] = p[i];
i++;
}
p_name[i] = '\0';
--- 228,238 ----
if (tb->tb.name_present) {
// Copy name from text because it may not be zero terminated.
const short l = MIN2<short>(*((short*)pc2), namelen - 1);
// Be very careful.
int i = 0; char* const p = (char*)pc2 + sizeof(short);
! while (i < l && os::is_readable_pointer(p + i)) {
p_name[i] = p[i];
i++;
}
p_name[i] = '\0';
*** 487,497 ****
static void print_info_for_pc (outputStream* st, codeptr_t pc, char* buf,
size_t buf_size, bool demangle) {
const struct tbtable* tb = NULL;
int displacement = -1;
! if (!MiscUtils::is_readable_pointer(pc)) {
st->print("(invalid)");
return;
}
if (AixSymbols::get_module_name((address)pc, buf, buf_size)) {
--- 487,497 ----
static void print_info_for_pc (outputStream* st, codeptr_t pc, char* buf,
size_t buf_size, bool demangle) {
const struct tbtable* tb = NULL;
int displacement = -1;
! if (!os::is_readable_pointer(pc)) {
st->print("(invalid)");
return;
}
if (AixSymbols::get_module_name((address)pc, buf, buf_size)) {
*** 695,705 ****
st->print_cr("------ current frame:");
st->print("iar: " PTR64_FORMAT " ", p2i(cur_iar));
print_info_for_pc(st, cur_iar, buf, buf_size, demangle);
st->cr();
! if (cur_iar && MiscUtils::is_readable_pointer(cur_iar)) {
decode_instructions_at_pc(
"Decoded instructions at iar:",
cur_iar, 32, 16, st);
}
--- 695,705 ----
st->print_cr("------ current frame:");
st->print("iar: " PTR64_FORMAT " ", p2i(cur_iar));
print_info_for_pc(st, cur_iar, buf, buf_size, demangle);
st->cr();
! if (cur_iar && os::is_readable_pointer(cur_iar)) {
decode_instructions_at_pc(
"Decoded instructions at iar:",
cur_iar, 32, 16, st);
}
*** 708,718 ****
// preserved via lr register.
st->print("lr: " PTR64_FORMAT " ", p2i(cur_lr));
print_info_for_pc(st, cur_lr, buf, buf_size, demangle);
st->cr();
! if (cur_lr && MiscUtils::is_readable_pointer(cur_lr)) {
decode_instructions_at_pc(
"Decoded instructions at lr:",
cur_lr, 32, 16, st);
}
--- 708,718 ----
// preserved via lr register.
st->print("lr: " PTR64_FORMAT " ", p2i(cur_lr));
print_info_for_pc(st, cur_lr, buf, buf_size, demangle);
st->cr();
! if (cur_lr && os::is_readable_pointer(cur_lr)) {
decode_instructions_at_pc(
"Decoded instructions at lr:",
cur_lr, 32, 16, st);
}
*** 727,737 ****
st->cr();
// Check and print rtoc.
st->print("rtoc: " PTR64_FORMAT " ", p2i(cur_rtoc));
if (cur_rtoc == NULL || cur_rtoc == (codeptr_t)-1 ||
! !MiscUtils::is_readable_pointer(cur_rtoc)) {
st->print("(invalid)");
} else if (((uintptr_t)cur_rtoc) & 0x7) {
st->print("(unaligned)");
}
st->cr();
--- 727,737 ----
st->cr();
// Check and print rtoc.
st->print("rtoc: " PTR64_FORMAT " ", p2i(cur_rtoc));
if (cur_rtoc == NULL || cur_rtoc == (codeptr_t)-1 ||
! !os::is_readable_pointer(cur_rtoc)) {
st->print("(invalid)");
} else if (((uintptr_t)cur_rtoc) & 0x7) {
st->print("(unaligned)");
}
st->cr();
< prev index next >