< prev index next >

src/hotspot/cpu/arm/frame_arm.cpp

Print this page


   1 /*
   2  * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 483     return false;
 484   }
 485   if (sp() == 0 || (intptr_t(sp()) & (wordSize-1)) != 0) {
 486     return false;
 487   }
 488   if (fp() + interpreter_frame_initial_sp_offset < sp()) {
 489     return false;
 490   }
 491   // These are hacks to keep us out of trouble.
 492   // The problem with these is that they mask other problems
 493   if (fp() <= sp()) {        // this attempts to deal with unsigned comparison above
 494     return false;
 495   }
 496   // do some validation of frame elements
 497 
 498   // first the method
 499 
 500   Method* m = *interpreter_frame_method_addr();
 501 
 502   // validate the method we'd find in this potential sender
 503   if (!m->is_valid_method()) return false;
 504 
 505   // stack frames shouldn't be much larger than max_stack elements
 506 
 507   if (fp() - sp() > 1024 + m->max_stack()*Interpreter::stackElementSize) {
 508     return false;
 509   }
 510 
 511   // validate bci/bcp
 512 
 513   address bcp = interpreter_frame_bcp();
 514   if (m->validate_bci_from_bcp(bcp) < 0) {
 515     return false;
 516   }
 517 
 518   // validate ConstantPoolCache*
 519   ConstantPoolCache* cp = *interpreter_frame_cache_addr();
 520   if (cp == NULL || !cp->is_metaspace_object()) return false;
 521 
 522   // validate locals
 523 


   1 /*
   2  * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 483     return false;
 484   }
 485   if (sp() == 0 || (intptr_t(sp()) & (wordSize-1)) != 0) {
 486     return false;
 487   }
 488   if (fp() + interpreter_frame_initial_sp_offset < sp()) {
 489     return false;
 490   }
 491   // These are hacks to keep us out of trouble.
 492   // The problem with these is that they mask other problems
 493   if (fp() <= sp()) {        // this attempts to deal with unsigned comparison above
 494     return false;
 495   }
 496   // do some validation of frame elements
 497 
 498   // first the method
 499 
 500   Method* m = *interpreter_frame_method_addr();
 501 
 502   // validate the method we'd find in this potential sender
 503   if (!Method::is_valid_method(m)) return false;
 504 
 505   // stack frames shouldn't be much larger than max_stack elements
 506 
 507   if (fp() - sp() > 1024 + m->max_stack()*Interpreter::stackElementSize) {
 508     return false;
 509   }
 510 
 511   // validate bci/bcp
 512 
 513   address bcp = interpreter_frame_bcp();
 514   if (m->validate_bci_from_bcp(bcp) < 0) {
 515     return false;
 516   }
 517 
 518   // validate ConstantPoolCache*
 519   ConstantPoolCache* cp = *interpreter_frame_cache_addr();
 520   if (cp == NULL || !cp->is_metaspace_object()) return false;
 521 
 522   // validate locals
 523 


< prev index next >