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

Issue 1276543006: Experimental: Bundle revalidation inside user callback

Created:
5 years, 4 months ago by ruiq
Modified:
5 years, 4 months ago
CC:
native-client-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/native_client/src/native_client.git@master
Target Ref:
refs/heads/master
Project:
nacl
Visibility:
Public.

Description

Bundle revalidation inside user callback This is an alternative approach for doing bundle revalidation. Instead of sending back information to the validator to instruct revalidation, the user callback directly invokes ValidateChunk[ARCH]() to validate the bundle containing current instruction. It will also rewrite the instructions of the bundle. And then ValidateCunk[ARCH] is called again in this callback to revalidate the rewritten bundle. Note that this CL is not completely cleaned up yet. BUG=None

Patch Set 1 #

Patch Set 2 : Cleanup #

Total comments: 3

Patch Set 3 : Address code review comments #

Patch Set 4 : Fix callback #

Patch Set 5 : Fix error checking #

Unified diffs Side-by-side diffs Delta from patch set Stats (+506 lines, -38 lines) Patch
M src/trusted/validator/build.scons View 1 chunk +26 lines, -0 lines 0 comments Download
M src/trusted/validator/validation_disable_nontemporals_test.cc View 2 chunks +18 lines, -7 lines 0 comments Download
A + src/trusted/validator/validation_rewrite_32_test.cc View 3 chunks +31 lines, -17 lines 0 comments Download
A src/trusted/validator/validation_rewrite_32_test_data.S View 1 chunk +41 lines, -0 lines 0 comments Download
A src/trusted/validator/validation_rewrite_64_test.cc View 1 chunk +138 lines, -0 lines 0 comments Download
A src/trusted/validator/validation_rewrite_64_test_data.S View 1 chunk +93 lines, -0 lines 0 comments Download
M src/trusted/validator_ragel/dfa_validate_32.c View 1 2 chunks +5 lines, -0 lines 0 comments Download
M src/trusted/validator_ragel/dfa_validate_64.c View 1 1 chunk +4 lines, -0 lines 0 comments Download
M src/trusted/validator_ragel/dfa_validate_common.h View 1 1 chunk +3 lines, -0 lines 0 comments Download
M src/trusted/validator_ragel/dfa_validate_common.c View 1 2 3 4 2 chunks +147 lines, -14 lines 0 comments Download

Messages

Total messages: 4 (2 generated)
ruiq
https://codereview.chromium.org/1276543006/diff/20001/src/trusted/validator_ragel/dfa_validate_common.c File src/trusted/validator_ragel/dfa_validate_common.c (right): https://codereview.chromium.org/1276543006/diff/20001/src/trusted/validator_ragel/dfa_validate_common.c#newcode133 src/trusted/validator_ragel/dfa_validate_common.c:133: bundle_begin = (uint8_t *) addr; We need to compute ...
5 years, 4 months ago (2015-08-10 00:26:08 UTC) #2
khimg
5 years, 4 months ago (2015-08-10 00:51:43 UTC) #4
I don't think it's good idea to use NaClRewriteUnsupportedInstruction twice. It
just looks strnge and makes logic somewhat unclear.

IMO it'll be simpler and cleaner to intorudce simple helper function which will
just skip DIRECT_JUMP_OUT_OF_RANGE errors and return FALSE for everything else
(CPUID-unsupported instructions must be already replaced with NOPs at this point
and non-temporal instructions should also be processed).

Perhaps it'll be few lines longer, but much simpler: first we rewrite the code,
then we check that everything is correct after rewrite.

https://codereview.chromium.org/1276543006/diff/20001/src/trusted/validator_r...
File src/trusted/validator_ragel/dfa_validate_common.c (right):

https://codereview.chromium.org/1276543006/diff/20001/src/trusted/validator_r...
src/trusted/validator_ragel/dfa_validate_common.c:49: if ((info &
VALIDATION_ERRORS_MASK) == CPUID_UNSUPPORTED_INSTRUCTION) {
Instead of VALIDATION_ERRORS_MASK we must use (VALIDATION_ERRORS_MASK &
~DIRECT_JUMP_OUT_OF_RANGE) - although some symbolic name for it will be good.

Otherwise jumps to unaligned addresses will erroneously trigger error here.
High-level validator will check these addresses for us.

https://codereview.chromium.org/1276543006/diff/20001/src/trusted/validator_r...
src/trusted/validator_ragel/dfa_validate_common.c:88: ptr[end - begin - 1] =
0x90;
Please insert NOP before mov, not after! Think about %rip!

Powered by Google App Engine
This is Rietveld 408576698