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

Unified Diff: src/trusted/validator/x86/ncval_reg_sfi/nc_jumps.c

Issue 9328024: Merge 7712 - Ensure super instructions are marked during dynamic code modification. (Closed) Base URL: svn://svn.chromium.org/native_client/branches/963/src/native_client/
Patch Set: '' Created 8 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: src/trusted/validator/x86/ncval_reg_sfi/nc_jumps.c
===================================================================
--- src/trusted/validator/x86/ncval_reg_sfi/nc_jumps.c (revision 7726)
+++ src/trusted/validator/x86/ncval_reg_sfi/nc_jumps.c (working copy)
@@ -97,8 +97,18 @@
else if ((to_address & state->alignment_mask) == 0 &&
(to_address & ~(NaClPcAddress) 0xffffffff) == 0) {
/* Allow bundle-aligned jump. */
- }
- else {
+ } else if (inst->unchanged) {
+ /* If we are replacing this instruction during dynamic code modification
+ * and it has not changed, the jump target must be valid because the
+ * instruction has been previously validated. However, we may be only
+ * replacing a subsection of the code segment and therefore may not have
+ * information about instruction boundaries outside of the code being
+ * replaced. Therefore, we allow unaligned direct jumps outside of the code
+ * being validated if and only if the instruction is unchanged.
+ * If dynamic code replacement is not being performed, inst->unchanged
+ * should always be false.
+ */
+ } else {
NaClValidatorInstMessage(LOG_ERROR, state, inst,
"Instruction jumps to bad address\n");
}
« no previous file with comments | « src/trusted/validator/x86/decoder/nc_inst_state_statics.c ('k') | src/trusted/validator/x86/ncval_reg_sfi/ncvalidate_iter.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698