Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: src/trusted/validator_arm/validator.cc

Issue 11361222: ARM validator: fix sandbox escape with SP update at the end of the last bundle (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Fix comments from mseaborn. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/trusted/validator_arm/model.h ('k') | src/trusted/validator_arm/validator_small_tests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include "native_client/src/trusted/service_runtime/nacl_config.h" 7 #include "native_client/src/trusted/service_runtime/nacl_config.h"
8 #include "native_client/src/trusted/validator_arm/model.h" 8 #include "native_client/src/trusted/validator_arm/model.h"
9 #include "native_client/src/trusted/validator_arm/validator.h" 9 #include "native_client/src/trusted/validator_arm/validator.h"
10 #include "native_client/src/include/nacl_macros.h" 10 #include "native_client/src/include/nacl_macros.h"
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 } 714 }
715 715
716 // Decrement the virtual address by one instruction, so the for 716 // Decrement the virtual address by one instruction, so the for
717 // loop can bump it back forward. This is slightly dirty. 717 // loop can bump it back forward. This is slightly dirty.
718 va -= 4; 718 va -= 4;
719 } 719 }
720 720
721 pred.Copy(inst); 721 pred.Copy(inst);
722 } 722 }
723 723
724 // Validate the last instruction, paired with a nop.
725 const Instruction nop(nacl_arm_dec::kNop);
726 DecodedInstruction one_past_end(segment.end_addr(), nop,
727 decode_state_.decode(nop));
728 complete_success &= apply_patterns(pred, one_past_end, critical, out);
729
724 return complete_success; 730 return complete_success;
725 } 731 }
726 732
727 static bool address_contained(uint32_t va, const vector<CodeSegment>& segs) { 733 static bool address_contained(uint32_t va, const vector<CodeSegment>& segs) {
728 for (vector<CodeSegment>::const_iterator it = segs.begin(); it != segs.end(); 734 for (vector<CodeSegment>::const_iterator it = segs.begin(); it != segs.end();
729 ++it) { 735 ++it) {
730 if (it->contains_address(va)) return true; 736 if (it->contains_address(va)) return true;
731 } 737 }
732 return false; 738 return false;
733 } 739 }
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 Instruction inst, 907 Instruction inst,
902 const ClassDecoder& decoder) 908 const ClassDecoder& decoder)
903 : vaddr_(vaddr), 909 : vaddr_(vaddr),
904 inst_(inst), 910 inst_(inst),
905 decoder_(&decoder), 911 decoder_(&decoder),
906 safety_(decoder.safety(inst_)), 912 safety_(decoder.safety(inst_)),
907 defs_(decoder.defs(inst_)) 913 defs_(decoder.defs(inst_))
908 {} 914 {}
909 915
910 } // namespace nacl_arm_val 916 } // namespace nacl_arm_val
OLDNEW
« no previous file with comments | « src/trusted/validator_arm/model.h ('k') | src/trusted/validator_arm/validator_small_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698