naclcall/nacljmp) must not be changed.dest, dest+size) region then it’s allowed as long as it’s not modified.The exception above exist to support modifications of small pieces of code in a large code block. If code was accepted by the nacl_dyncode_create then it means that all the targets in all jcc, jmp, and call instructions are valid WRT their targets — and if jcc, jmp, or call point to unknown (in the nacl_dyncode_modify) address everything is fine as long as this address is unmodified: if it was valid once it’s valid always because modifications of instruction boundaries are not allowed.
movcallRationale for the exception in x86-64 case is the same as in ia32 case.
This logic is implemented in dfa_validate_xxx.c files. Function ApplyDfaValidator_x86_xx implements initial validation (used in nacl_dyncode_create) while couple of functions ValidatorCodeReplacement_x86_xx/ValidatorCopy_x86_xx are used in nacl_dyncode_modify (ValidatorCodeReplacement_x86_xx determines if the rules above are unbroken and ValidatorCopy_x86_xx is used to process instructions one-after-another by NaClCopyInstructionFunc). Note: ValidatorCopy_x86_xx assumes code was accepted by the ValidatorCodeReplacement_x86_xx function. Result for code which is not verified by ValidatorCodeReplacement_x86_xx is not defined and NaClCopyInstructionFunc is external function passed to ValidatorCopy_x86_xx which guarantees safe replacement of a single instruction in a presence of threads.