| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2011 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 /* | 7 /* |
| 8 * nc_jumps_detailed.c - Validate jumps using a second pass of the | 8 * nc_jumps_detailed.c - Validate jumps using a second pass of the |
| 9 * isntructions. | 9 * isntructions. |
| 10 */ | 10 */ |
| 11 | 11 |
| 12 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/nc_jumps_detaile
d.h" | 12 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/nc_jumps_detaile
d.h" |
| 13 | 13 |
| 14 #include "native_client/src/shared/platform/nacl_log.h" | 14 #include "native_client/src/shared/platform/nacl_log.h" |
| 15 #include "native_client/src/trusted/validator/x86/decoder/nc_inst_iter.h" | 15 #include "native_client/src/trusted/validator/x86/decoder/nc_inst_iter_inl.h" |
| 16 #include "native_client/src/trusted/validator/x86/decoder/nc_inst_state_internal
.h" | 16 #include "native_client/src/trusted/validator/x86/decoder/nc_inst_state_internal
.h" |
| 17 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/ncvalidate_iter.
h" | 17 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/ncvalidate_iter.
h" |
| 18 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/ncvalidate_iter_
internal.h" | 18 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/ncvalidate_iter_
internal.h" |
| 19 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/nc_jumps.h" | 19 #include "native_client/src/trusted/validator/x86/ncval_reg_sfi/nc_jumps.h" |
| 20 | 20 |
| 21 /* Returns true if the given address is within the code segment. | 21 /* Returns true if the given address is within the code segment. |
| 22 */ | 22 */ |
| 23 static Bool NaClCheckAddressRange(NaClPcAddress address, | 23 static Bool NaClCheckAddressRange(NaClPcAddress address, |
| 24 NaClValidatorState* state) { | 24 NaClValidatorState* state) { |
| 25 if (address < state->vbase) { | 25 if (address < state->vbase) { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 /* Perform second pass on instructions to find instructions crossing | 127 /* Perform second pass on instructions to find instructions crossing |
| 128 * block boundaries, and (explicitly) branch to bad places. | 128 * block boundaries, and (explicitly) branch to bad places. |
| 129 */ | 129 */ |
| 130 do { | 130 do { |
| 131 check_iter = NaClInstIterCreate(state->decoder_tables, iter->segment); | 131 check_iter = NaClInstIterCreate(state->decoder_tables, iter->segment); |
| 132 if (NULL == check_iter) { | 132 if (NULL == check_iter) { |
| 133 NaClValidatorMessage(LOG_ERROR, state, | 133 NaClValidatorMessage(LOG_ERROR, state, |
| 134 "Not enough memory to check jumps\n"); | 134 "Not enough memory to check jumps\n"); |
| 135 break; | 135 break; |
| 136 } | 136 } |
| 137 for (; NaClInstIterHasNext(check_iter); NaClInstIterAdvance(check_iter)) { | 137 for (; NaClInstIterHasNextInline(check_iter); |
| 138 NaClInstState* inst_state = NaClInstIterGetState(check_iter); | 138 NaClInstIterAdvanceInline(check_iter)) { |
| 139 NaClInstState* inst_state = NaClInstIterGetStateInline(check_iter); |
| 139 NaClInstLayoutCheck(state, inst_state, jump_sets); | 140 NaClInstLayoutCheck(state, inst_state, jump_sets); |
| 140 } | 141 } |
| 141 NaClInstIterDestroy(check_iter); | 142 NaClInstIterDestroy(check_iter); |
| 142 } while (0); | 143 } while (0); |
| 143 } | 144 } |
| OLD | NEW |