OLD | NEW |
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 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_VALIDATOR_H_ | 7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_VALIDATOR_H_ |
8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_VALIDATOR_H_ | 8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_VALIDATOR_H_ |
9 | 9 |
10 #include "native_client/src/trusted/validator_ragel/decoder.h" | 10 #include "native_client/src/trusted/validator_ragel/decoder.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 /* Operations with %ebp must be followed with sandboxing immediately. */ | 69 /* Operations with %ebp must be followed with sandboxing immediately. */ |
70 RESTRICTED_RBP_UNPROCESSED = 0x00080000, | 70 RESTRICTED_RBP_UNPROCESSED = 0x00080000, |
71 /* Attemp to "sandbox" %rbp without restricting it first. */ | 71 /* Attemp to "sandbox" %rbp without restricting it first. */ |
72 UNRESTRICTED_RBP_PROCESSED = 0x00180000, | 72 UNRESTRICTED_RBP_PROCESSED = 0x00180000, |
73 /* Operations with %esp must be followed with sandboxing immediately. */ | 73 /* Operations with %esp must be followed with sandboxing immediately. */ |
74 RESTRICTED_RSP_UNPROCESSED = 0x00280000, | 74 RESTRICTED_RSP_UNPROCESSED = 0x00280000, |
75 /* Attemp to "sandbox" %rsp without restricting it first. */ | 75 /* Attemp to "sandbox" %rsp without restricting it first. */ |
76 UNRESTRICTED_RSP_PROCESSED = 0x00380000, | 76 UNRESTRICTED_RSP_PROCESSED = 0x00380000, |
77 /* Operations with %r15 are forbidden. */ | 77 /* Operations with %r15 are forbidden. */ |
78 R15_MODIFIED = 0x00400000, | 78 R15_MODIFIED = 0x00400000, |
79 /* Operations with BPL are forbidden for compatibility with old validator. */ | 79 /* Operations with %xBP are forbidden. */ |
80 BPL_MODIFIED = 0x00800000, | 80 /* This includes %bpl for compatibility with old validator. */ |
81 /* Operations with SPL are forbidden for compatibility with old validator. */ | 81 BP_MODIFIED = 0x00800000, |
82 SPL_MODIFIED = 0x01000000, | 82 /* Operations with %xSP are forbidden. */ |
| 83 /* This includes %spl for compatibility with old validator. */ |
| 84 SP_MODIFIED = 0x01000000, |
83 /* Bad call alignment: "call" must end at the end of the bundle. */ | 85 /* Bad call alignment: "call" must end at the end of the bundle. */ |
84 BAD_CALL_ALIGNMENT = 0x02000000, | 86 BAD_CALL_ALIGNMENT = 0x02000000, |
85 /* Instruction is modifiable by nacl_dyncode_modify. */ | 87 /* Instruction is modifiable by nacl_dyncode_modify. */ |
86 MODIFIABLE_INSTRUCTION = 0x08000000, | 88 MODIFIABLE_INSTRUCTION = 0x08000000, |
87 /* Special instruction. Uses different, non-standard validation rules. */ | 89 /* Special instruction. Uses different, non-standard validation rules. */ |
88 SPECIAL_INSTRUCTION = 0x10000000, | 90 SPECIAL_INSTRUCTION = 0x10000000, |
89 /* Some 3DNow! instructions use immediate byte as opcode extensions. */ | 91 /* Some 3DNow! instructions use immediate byte as opcode extensions. */ |
90 LAST_BYTE_IS_NOT_IMMEDIATE = 0x20000000, | 92 LAST_BYTE_IS_NOT_IMMEDIATE = 0x20000000, |
91 /* Bad jump target. Note: in this case ptr points to jump target! */ | 93 /* Bad jump target. Note: in this case ptr points to jump target! */ |
92 BAD_JUMP_TARGET = 0x40000000 | 94 BAD_JUMP_TARGET = 0x40000000 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 * Alternatively, if CALL_USER_CALLBACK_ON_EACH_INSTRUCTION flag in options is | 171 * Alternatively, if CALL_USER_CALLBACK_ON_EACH_INSTRUCTION flag in options is |
170 * set, user_callback is called for every instruction. | 172 * set, user_callback is called for every instruction. |
171 * If PROCESS_CHUNK_AS_A_CONTIGUOUS_STREAM flag in options is set, | 173 * If PROCESS_CHUNK_AS_A_CONTIGUOUS_STREAM flag in options is set, |
172 * instructions crossing bundle boundaries are not considered erroneous. | 174 * instructions crossing bundle boundaries are not considered erroneous. |
173 * | 175 * |
174 * Actually validation result is computed as conjunction of values returned | 176 * Actually validation result is computed as conjunction of values returned |
175 * by all invocations of user_callback, so custom validation logic can be | 177 * by all invocations of user_callback, so custom validation logic can be |
176 * placed there. | 178 * placed there. |
177 */ | 179 */ |
178 DLLEXPORT | 180 DLLEXPORT |
179 Bool ValidateChunkAMD64(const uint8_t *data, size_t size, | 181 Bool ValidateChunkAMD64(const uint8_t codeblock[], |
| 182 size_t size, |
180 uint32_t options, | 183 uint32_t options, |
181 const NaClCPUFeaturesX86 *cpu_features, | 184 const NaClCPUFeaturesX86 *cpu_features, |
182 ValidationCallbackFunc user_callback, | 185 ValidationCallbackFunc user_callback, |
183 void *callback_data); | 186 void *callback_data); |
184 | 187 |
185 /* | 188 /* |
186 * See ValidateChunkAMD64 | 189 * See ValidateChunkAMD64 |
187 */ | 190 */ |
188 DLLEXPORT | 191 DLLEXPORT |
189 Bool ValidateChunkIA32(const uint8_t *data, size_t size, | 192 Bool ValidateChunkIA32(const uint8_t codeblock[], |
| 193 size_t size, |
190 uint32_t options, | 194 uint32_t options, |
191 const NaClCPUFeaturesX86 *cpu_features, | 195 const NaClCPUFeaturesX86 *cpu_features, |
192 ValidationCallbackFunc user_callback, | 196 ValidationCallbackFunc user_callback, |
193 void *callback_data); | 197 void *callback_data); |
194 | 198 |
195 EXTERN_C_END | 199 EXTERN_C_END |
196 | 200 |
197 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_VALIDATOR_H_ */ | 201 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_RAGEL_VALIDATOR_H_ */ |
OLD | NEW |