--- a/src/hotspot/os_cpu/linux_s390/thread_linux_s390.cpp Thu Oct 24 16:28:49 2019 +0200
+++ b/src/hotspot/os_cpu/linux_s390/thread_linux_s390.cpp Thu Oct 24 16:28:51 2019 +0200
@@ -63,21 +63,24 @@
if (ret_frame.is_interpreted_frame()) {
frame::z_ijava_state* istate = ret_frame.ijava_state_unchecked();
- if ((stack_base() >= (address)istate && (address)istate > stack_end()) ||
- MetaspaceObj::is_valid((Method*)(istate->method)) == false) {
- return false;
- }
- uint64_t reg_bcp = uc->uc_mcontext.gregs[13/*Z_BCP*/];
- uint64_t istate_bcp = istate->bcp;
- uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base());
- uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size());
- if (istate_bcp >= code_start && istate_bcp < code_end) {
- // we have a valid bcp, don't touch it, do nothing
- } else if (reg_bcp >= code_start && reg_bcp < code_end) {
- istate->bcp = reg_bcp;
- } else {
- return false;
- }
+ if (stack_base() >= (address)istate && (address)istate > stack_end()) {
+ return false;
+ }
+ const Method *m = (const Method*)(istate->method);
+ if (!Method::is_valid_method(m)) return false;
+ if (!Metaspace::contains(m->constMethod())) return false;
+
+ uint64_t reg_bcp = uc->uc_mcontext.gregs[13/*Z_BCP*/];
+ uint64_t istate_bcp = istate->bcp;
+ uint64_t code_start = (uint64_t)(m->code_base());
+ uint64_t code_end = (uint64_t)(m->code_base() + m->code_size());
+ if (istate_bcp >= code_start && istate_bcp < code_end) {
+ // we have a valid bcp, don't touch it, do nothing
+ } else if (reg_bcp >= code_start && reg_bcp < code_end) {
+ istate->bcp = reg_bcp;
+ } else {
+ return false;
+ }
}
if (!ret_frame.safe_for_sender(this)) {
// nothing else to try if the frame isn't good