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

Side by Side Diff: src/trusted/validator_x86/testdata/64/tests_from_pydfa.test

Issue 625923004: Delete old x86 validator. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: rebase master Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 @hex:
2 # Originally these tests came from
3 # https://github.com/mseaborn/x86-decoder/blob/x86-64/validator_test.py
4
5 # Check some simple allowed instructions.
6 # nop
7 90
8 # hlt
9 f4
10 # mov $0x12345678, %rax
11 48 c7 c0 78 56 34 12
12 # mov $0x1234567812345678, %rax
13 48 b8 78 56 34 12 78 56 34 12
14 @rval:
15 VALIDATOR: Checking jump targets: 0 to 13
16 VALIDATOR: Checking that basic blocks are aligned
17 *** <input> is safe ***
18 @dis:
19 0000000000000000: 90 nop
20 0000000000000001: f4 hlt
21 0000000000000002: 48 c7 c0 78 56 34 12 mov %rax, 0x123 45678
22 0000000000000009: 48 b8 78 56 34 12 78 56 34 12 mov %rax, 0x123 4567812345678
23 @rdfa_output:
24 return code: 0
25 ----------------------------------------------------------------------
26 @hex:
27 # Check a disallowed instruction.
28 # nop
29 90
30 # int $0x80
31 cd 80
32 @rval:
33 VALIDATOR: 0000000000000001: cd 80 int 0x80
34 VALIDATOR: ERROR: This instruction has been marked illegal by Native Client
35 VALIDATOR: Checking jump targets: 0 to 3
36 VALIDATOR: Checking that basic blocks are aligned
37 *** <input> IS UNSAFE ***
38 @dis:
39 0000000000000000: 90 nop
40 0000000000000001: cd 80 int 0x80
41 @rdfa_output:
42 1: [0] unrecognized instruction
43 return code: 1
44 ----------------------------------------------------------------------
45 @hex:
46 # ret
47 c3
48 @rval:
49 VALIDATOR: 0000000000000000: c3 ret
50 VALIDATOR: ERROR: This instruction has been marked illegal by Native Client
51 VALIDATOR: 0000000000000000: c3 ret
52 VALIDATOR: ERROR: Illegal assignment to RSP
53 VALIDATOR: Checking jump targets: 0 to 1
54 VALIDATOR: Checking that basic blocks are aligned
55 *** <input> IS UNSAFE ***
56 @dis:
57 0000000000000000: c3 ret
58 @rdfa_output:
59 0: [0] unrecognized instruction
60 return code: 1
61 ----------------------------------------------------------------------
62 @hex:
63 # syscall
64 0f 05
65 @rval:
66 VALIDATOR: 0000000000000000: 0f 05 sysc all
67 VALIDATOR: ERROR: This instruction has been marked illegal by Native Client
68 VALIDATOR: 0000000000000000: 0f 05 sysc all
69 VALIDATOR: ERROR: System instructions are not allowed by Native Client
70 VALIDATOR: Checking jump targets: 0 to 2
71 VALIDATOR: Checking that basic blocks are aligned
72 *** <input> IS UNSAFE ***
73 @dis:
74 0000000000000000: 0f 05 syscall
75 @rdfa_output:
76 0: [0] unrecognized instruction
77 return code: 1
78 ----------------------------------------------------------------------
79 @hex:
80 # mov $0x1234567812345678, %rax
81 48 b8 78 56 34 12 78 56 34 12
82 # mov $0x1234567812345678, %rax
83 48 b8 78 56 34 12 78 56 34 12
84 # mov $0x1234567812345678, %rax
85 48 b8 78 56 34 12 78 56 34 12
86 # mov $0x1234567812345678, %rax
87 48 b8 78 56 34 12 78 56 34 12
88 @rval:
89 VALIDATOR: Checking jump targets: 0 to 28
90 VALIDATOR: Checking that basic blocks are aligned
91 VALIDATOR: ERROR: 20: Bad basic block alignment.
92 *** <input> IS UNSAFE ***
93 @dis:
94 0000000000000000: 48 b8 78 56 34 12 78 56 34 12 mov %rax, 0x123 4567812345678
95 000000000000000a: 48 b8 78 56 34 12 78 56 34 12 mov %rax, 0x123 4567812345678
96 0000000000000014: 48 b8 78 56 34 12 78 56 34 12 mov %rax, 0x123 4567812345678
97 000000000000001e: 48 b8 78 56 34 12 78 56 34 12 mov %rax, 0x123 4567812345678
98 @rdfa_output:
99 1e: [0] unrecognized instruction
100 20: [0] direct jump out of range
101 24: [0] direct jump out of range
102 return code: 1
103 @validators_disagree:
104 Because RDFA validator recovered after bundle boundary.
105 ----------------------------------------------------------------------
106 @hex:
107 # Forwards and backwards jumps.
108 # nop
109 90
110 # jmp .+6
111 eb 04
112 # jmp .+0
113 eb fe
114 # jmp .-2
115 eb fc
116 # jmp .-4
117 eb fa
118 @rval:
119 VALIDATOR: Checking jump targets: 0 to 9
120 VALIDATOR: Checking that basic blocks are aligned
121 *** <input> is safe ***
122 @dis:
123 0000000000000000: 90 nop
124 0000000000000001: eb 04 jmp 0x7
125 0000000000000003: eb fe jmp 0x3
126 0000000000000005: eb fc jmp 0x3
127 0000000000000007: eb fa jmp 0x3
128 @rdfa_output:
129 return code: 0
130 ----------------------------------------------------------------------
131 @hex:
132 # Out-of-range unaligned jump.
133 # jmp .-1
134 eb fd
135 @rval:
136 VALIDATOR: 0000000000000000: eb fd jmp 0xffffffffffffffff
137 VALIDATOR: ERROR: Instruction jumps to bad address
138 VALIDATOR: Checking jump targets: 0 to 2
139 VALIDATOR: Checking that basic blocks are aligned
140 *** <input> IS UNSAFE ***
141 @dis:
142 0000000000000000: eb fd jmp 0xfffffffff fffffff
143 @rdfa_output:
144 0: [0] direct jump out of range
145 return code: 1
146 ----------------------------------------------------------------------
147 @hex:
148 # Out-of-range unaligned jump.
149 # jmp .+33
150 eb 1f
151 @rval:
152 VALIDATOR: 0000000000000000: eb 1f jmp 0x21
153 VALIDATOR: ERROR: Instruction jumps to bad address
154 VALIDATOR: Checking jump targets: 0 to 2
155 VALIDATOR: Checking that basic blocks are aligned
156 *** <input> IS UNSAFE ***
157 @dis:
158 0000000000000000: eb 1f jmp 0x21
159 @rdfa_output:
160 0: [0] direct jump out of range
161 return code: 1
162 ----------------------------------------------------------------------
163 @hex:
164 # Jump into instruction.
165 # mov $0x1234567812345678, %rax
166 48 b8 78 56 34 12 78 56 34 12
167 # jmp .-5
168 eb f9
169 @rval:
170 VALIDATOR: Checking jump targets: 0 to c
171 VALIDATOR: ERROR: 5: Bad jump target
172 VALIDATOR: Checking that basic blocks are aligned
173 *** <input> IS UNSAFE ***
174 @dis:
175 0000000000000000: 48 b8 78 56 34 12 78 56 34 12 mov %rax, 0x123 4567812345678
176 000000000000000a: eb f9 jmp 0x5
177 @rdfa_output:
178 a: [0] bad jump target
179 return code: 1
180 @validators_disagree:
181 Difference in jump reporting.
182 ----------------------------------------------------------------------
183 @hex:
184 # Unmasked indirect jumps are disallowed.
185 # jmp *%rax
186 ff e0
187 @rval:
188 VALIDATOR: 0000000000000000: ff e0 jmp %rax
189 VALIDATOR: ERROR: Invalid indirect jump
190 VALIDATOR: Checking jump targets: 0 to 2
191 VALIDATOR: Checking that basic blocks are aligned
192 *** <input> IS UNSAFE ***
193 @dis:
194 0000000000000000: ff e0 jmp %rax
195 @rdfa_output:
196 0: [0] unrecognized instruction
197 return code: 1
198 ----------------------------------------------------------------------
199 @hex:
200 # jmp *(%rax)
201 ff 20
202 @rval:
203 VALIDATOR: 0000000000000000: ff 20 jmp [%rax]
204 VALIDATOR: ERROR: Invalid base register in memory offset
205 VALIDATOR: 0000000000000000: ff 20 jmp [%rax]
206 VALIDATOR: ERROR: Jump not native client compliant
207 VALIDATOR: Checking jump targets: 0 to 2
208 VALIDATOR: Checking that basic blocks are aligned
209 *** <input> IS UNSAFE ***
210 @dis:
211 0000000000000000: ff 20 jmp [%rax]
212 @rdfa_output:
213 0: [0] unrecognized instruction
214 return code: 1
215 ----------------------------------------------------------------------
216 @hex:
217 # call *%rax
218 ff d0
219 @rval:
220 VALIDATOR: 0000000000000000: ff d0 call %rax
221 VALIDATOR: ERROR: Invalid indirect jump
222 VALIDATOR: 0000000000000000: ff d0 call %rax
223 VALIDATOR: WARNING: Bad call alignment, return pc = 2
224 VALIDATOR: Checking jump targets: 0 to 2
225 VALIDATOR: Checking that basic blocks are aligned
226 *** <input> IS UNSAFE ***
227 @dis:
228 0000000000000000: ff d0 call %rax
229 @rdfa_output:
230 0: [0] unrecognized instruction
231 return code: 1
232 ----------------------------------------------------------------------
233 @hex:
234 # call *(%rax)
235 ff 10
236 @rval:
237 VALIDATOR: 0000000000000000: ff 10 call [%rax]
238 VALIDATOR: ERROR: Invalid base register in memory offset
239 VALIDATOR: 0000000000000000: ff 10 call [%rax]
240 VALIDATOR: ERROR: Jump not native client compliant
241 VALIDATOR: 0000000000000000: ff 10 call [%rax]
242 VALIDATOR: WARNING: Bad call alignment, return pc = 2
243 VALIDATOR: Checking jump targets: 0 to 2
244 VALIDATOR: Checking that basic blocks are aligned
245 *** <input> IS UNSAFE ***
246 @dis:
247 0000000000000000: ff 10 call [%rax]
248 @rdfa_output:
249 0: [0] unrecognized instruction
250 return code: 1
251 ----------------------------------------------------------------------
252 @hex:
253 # Masking instructions on their own are allowed.
254 # and $~31, %eax
255 83 e0 e0
256 # and $~31, %ebx
257 83 e3 e0
258 # and $~31, %rax
259 48 83 e0 e0
260 # and $~31, %rbx
261 48 83 e3 e0
262 @rval:
263 VALIDATOR: Checking jump targets: 0 to e
264 VALIDATOR: Checking that basic blocks are aligned
265 *** <input> is safe ***
266 @dis:
267 0000000000000000: 83 e0 e0 and %eax, 0xe0
268 0000000000000003: 83 e3 e0 and %ebx, 0xe0
269 0000000000000006: 48 83 e0 e0 and %rax, 0xe0
270 000000000000000a: 48 83 e3 e0 and %rbx, 0xe0
271 @rdfa_output:
272 return code: 0
273 ----------------------------------------------------------------------
274 @hex:
275 # and $~31, %eax
276 83 e0 e0
277 # add %r15, %rax
278 4c 01 f8
279
280 # and $~31, %ebx
281 83 e3 e0
282 # add %r15, %rbx
283 4c 01 fb
284 @rval:
285 VALIDATOR: Checking jump targets: 0 to c
286 VALIDATOR: Checking that basic blocks are aligned
287 *** <input> is safe ***
288 @dis:
289 0000000000000000: 83 e0 e0 and %eax, 0xe0
290 0000000000000003: 4c 01 f8 add %rax, %r15
291 0000000000000006: 83 e3 e0 and %ebx, 0xe0
292 0000000000000009: 4c 01 fb add %rbx, %r15
293 @rdfa_output:
294 return code: 0
295 ----------------------------------------------------------------------
296 @hex:
297 # Masked indirect jumps are allowed.
298 # and $~31, %eax
299 83 e0 e0 \\
300 # add %r15, %rax
301 4c 01 f8 \\
302 # jmp *%rax
303 ff e0
304 @rval:
305 VALIDATOR: Checking jump targets: 0 to 8
306 VALIDATOR: Checking that basic blocks are aligned
307 *** <input> is safe ***
308 @dis:
309 0000000000000000: 83 e0 e0 and %eax, 0xe0
310 0000000000000003: 4c 01 f8 add %rax, %r15
311 0000000000000006: ff e0 jmp %rax
312 @rdfa_output:
313 return code: 0
314 ----------------------------------------------------------------------
315 @hex:
316 # and $~31, %ebx
317 83 e3 e0 \\
318 # add %r15, %rbx
319 4c 01 fb \\
320 # call *%rbx
321 ff d3
322 @rval:
323 VALIDATOR: 0000000000000006: ff d3 call %rbx
324 VALIDATOR: WARNING: Bad call alignment, return pc = 8
325 VALIDATOR: Checking jump targets: 0 to 8
326 VALIDATOR: Checking that basic blocks are aligned
327 *** <input> is safe ***
328 @dis:
329 0000000000000000: 83 e3 e0 and %ebx, 0xe0
330 0000000000000003: 4c 01 fb add %rbx, %r15
331 0000000000000006: ff d3 call %rbx
332 @rdfa_output:
333 return code: 0
334 ----------------------------------------------------------------------
335 @hex:
336 # The registers must match up for the mask and the jump.
337 # and $~31, %ebx
338 83 e3 e0
339 # add %r15, %rax
340 4c 01 f8
341 # jmp *%rax
342 ff e0
343 @rval:
344 VALIDATOR: 0000000000000006: ff e0 jmp %rax
345 VALIDATOR: ERROR: Invalid indirect jump
346 VALIDATOR: Checking jump targets: 0 to 8
347 VALIDATOR: Checking that basic blocks are aligned
348 *** <input> IS UNSAFE ***
349 @dis:
350 0000000000000000: 83 e3 e0 and %ebx, 0xe0
351 0000000000000003: 4c 01 f8 add %rax, %r15
352 0000000000000006: ff e0 jmp %rax
353 @rdfa_output:
354 6: [0] unrecognized instruction
355 return code: 1
356 @validators_disagree:
357 Difference in error reporting.
358 ----------------------------------------------------------------------
359 @hex:
360 # and $~31, %eax
361 83 e0 e0
362 # add %r15, %rbx
363 4c 01 fb
364 # jmp *%rax
365 ff e0
366 @rval:
367 VALIDATOR: 0000000000000006: ff e0 jmp %rax
368 VALIDATOR: ERROR: Invalid indirect jump
369 VALIDATOR: Checking jump targets: 0 to 8
370 VALIDATOR: Checking that basic blocks are aligned
371 *** <input> IS UNSAFE ***
372 @dis:
373 0000000000000000: 83 e0 e0 and %eax, 0xe0
374 0000000000000003: 4c 01 fb add %rbx, %r15
375 0000000000000006: ff e0 jmp %rax
376 @rdfa_output:
377 6: [0] unrecognized instruction
378 return code: 1
379 @validators_disagree:
380 Difference in error reporting.
381 ----------------------------------------------------------------------
382 @hex:
383 # and $~31, %eax
384 83 e0 e0
385 # add %r15, %rax
386 4c 01 f8
387 # jmp *%rbx
388 ff e3
389 @rval:
390 VALIDATOR: 0000000000000006: ff e3 jmp %rbx
391 VALIDATOR: ERROR: Invalid indirect jump
392 VALIDATOR: Checking jump targets: 0 to 8
393 VALIDATOR: Checking that basic blocks are aligned
394 *** <input> IS UNSAFE ***
395 @dis:
396 0000000000000000: 83 e0 e0 and %eax, 0xe0
397 0000000000000003: 4c 01 f8 add %rax, %r15
398 0000000000000006: ff e3 jmp %rbx
399 @rdfa_output:
400 6: [0] unrecognized instruction
401 return code: 1
402 @validators_disagree:
403 Difference in error reporting.
404 ----------------------------------------------------------------------
405 @hex:
406 # and $~31, %eax
407 83 e0 e0
408 # add %r15, %rbx
409 4c 01 fb
410 # jmp *%rbx
411 ff e3
412 @rval:
413 VALIDATOR: 0000000000000006: ff e3 jmp %rbx
414 VALIDATOR: ERROR: Invalid indirect jump
415 VALIDATOR: Checking jump targets: 0 to 8
416 VALIDATOR: Checking that basic blocks are aligned
417 *** <input> IS UNSAFE ***
418 @dis:
419 0000000000000000: 83 e0 e0 and %eax, 0xe0
420 0000000000000003: 4c 01 fb add %rbx, %r15
421 0000000000000006: ff e3 jmp %rbx
422 @rdfa_output:
423 6: [0] unrecognized instruction
424 return code: 1
425 @validators_disagree:
426 Difference in error reporting.
427 ----------------------------------------------------------------------
428 @hex:
429 # and $~31, %ebx
430 83 e3 e0
431 # add %r15, %rbx
432 4c 01 fb
433 # jmp *%rax
434 ff e0
435 @rval:
436 VALIDATOR: 0000000000000006: ff e0 jmp %rax
437 VALIDATOR: ERROR: Invalid indirect jump
438 VALIDATOR: Checking jump targets: 0 to 8
439 VALIDATOR: Checking that basic blocks are aligned
440 *** <input> IS UNSAFE ***
441 @dis:
442 0000000000000000: 83 e3 e0 and %ebx, 0xe0
443 0000000000000003: 4c 01 fb add %rbx, %r15
444 0000000000000006: ff e0 jmp %rax
445 @rdfa_output:
446 6: [0] unrecognized instruction
447 return code: 1
448 @validators_disagree:
449 Difference in error reporting.
450 ----------------------------------------------------------------------
451 @hex:
452 # The mask and the jump must be adjacent.
453 # and $~31, %eax
454 83 e0 e0
455 # nop
456 90
457 # add %r15, %rax
458 4c 01 f8
459 # jmp *%rax
460 ff e0
461 @rval:
462 VALIDATOR: 0000000000000007: ff e0 jmp %rax
463 VALIDATOR: ERROR: Invalid indirect jump
464 VALIDATOR: Checking jump targets: 0 to 9
465 VALIDATOR: Checking that basic blocks are aligned
466 *** <input> IS UNSAFE ***
467 @dis:
468 0000000000000000: 83 e0 e0 and %eax, 0xe0
469 0000000000000003: 90 nop
470 0000000000000004: 4c 01 f8 add %rax, %r15
471 0000000000000007: ff e0 jmp %rax
472 @rdfa_output:
473 7: [0] unrecognized instruction
474 return code: 1
475 ----------------------------------------------------------------------
476 @hex:
477 # and $~31, %eax
478 83 e0 e0
479 # add %r15, %rax
480 4c 01 f8
481 # nop
482 90
483 # jmp *%rax
484 ff e0
485 @rval:
486 VALIDATOR: 0000000000000007: ff e0 jmp %rax
487 VALIDATOR: ERROR: Invalid indirect jump
488 VALIDATOR: Checking jump targets: 0 to 9
489 VALIDATOR: Checking that basic blocks are aligned
490 *** <input> IS UNSAFE ***
491 @dis:
492 0000000000000000: 83 e0 e0 and %eax, 0xe0
493 0000000000000003: 4c 01 f8 add %rax, %r15
494 0000000000000006: 90 nop
495 0000000000000007: ff e0 jmp %rax
496 @rdfa_output:
497 7: [0] unrecognized instruction
498 return code: 1
499 ----------------------------------------------------------------------
500 @hex:
501 # Jumping into the middle of the superinstruction must be rejected.
502 # and $~31, %eax
503 83 e0 e0
504 # add %r15, %rax
505 4c 01 f8
506 # jmp *%rax
507 ff e0
508 # jmp .-2
509 eb fc
510 @rval:
511 VALIDATOR: Checking jump targets: 0 to a
512 VALIDATOR: ERROR: 6: Bad jump target
513 VALIDATOR: Checking that basic blocks are aligned
514 *** <input> IS UNSAFE ***
515 @dis:
516 0000000000000000: 83 e0 e0 and %eax, 0xe0
517 0000000000000003: 4c 01 f8 add %rax, %r15
518 0000000000000006: ff e0 jmp %rax
519 0000000000000008: eb fc jmp 0x6
520 @rdfa_output:
521 8: [0] bad jump target
522 return code: 1
523 @validators_disagree:
524 Difference in jump reporting.
525 ----------------------------------------------------------------------
526 @hex:
527 # and $~31, %eax
528 83 e0 e0
529 # add %r15, %rax
530 4c 01 f8
531 # jmp *%rax
532 ff e0
533 # jmp .-5
534 eb f9
535 @rval:
536 VALIDATOR: Checking jump targets: 0 to a
537 VALIDATOR: ERROR: 3: Bad jump target
538 VALIDATOR: Checking that basic blocks are aligned
539 *** <input> IS UNSAFE ***
540 @dis:
541 0000000000000000: 83 e0 e0 and %eax, 0xe0
542 0000000000000003: 4c 01 f8 add %rax, %r15
543 0000000000000006: ff e0 jmp %rax
544 0000000000000008: eb f9 jmp 0x3
545 @rdfa_output:
546 8: [0] bad jump target
547 return code: 1
548 @validators_disagree:
549 TODO: explain this
550 Difference in jump reporting.
551 ----------------------------------------------------------------------
552 @hex:
553 # Read-only access to special registers is allowed.
554 # push %rax
555 50
556 # push %rbp
557 55
558 # push %rsp
559 54
560 # push %r15
561 41 57
562 # mov %rsp, %rax
563 48 89 e0
564 @rval:
565 VALIDATOR: Checking jump targets: 0 to 8
566 VALIDATOR: Checking that basic blocks are aligned
567 *** <input> is safe ***
568 @dis:
569 0000000000000000: 50 push %rax
570 0000000000000001: 55 push %rbp
571 0000000000000002: 54 push %rsp
572 0000000000000003: 41 57 push %r15
573 0000000000000005: 48 89 e0 mov %rax, %rsp
574 @rdfa_output:
575 return code: 0
576 ----------------------------------------------------------------------
577 @hex:
578 # Write access to special registers is not allowed.
579 # pop %rax
580 58
581 @rval:
582 VALIDATOR: Checking jump targets: 0 to 1
583 VALIDATOR: Checking that basic blocks are aligned
584 *** <input> is safe ***
585 @dis:
586 0000000000000000: 58 pop %rax
587 @rdfa_output:
588 return code: 0
589 ----------------------------------------------------------------------
590 @hex:
591 # pop %rbp
592 5d
593 @rval:
594 VALIDATOR: 0000000000000000: 5d pop %rbp
595 VALIDATOR: ERROR: Illegal change to register RBP
596 VALIDATOR: Checking jump targets: 0 to 1
597 VALIDATOR: Checking that basic blocks are aligned
598 *** <input> IS UNSAFE ***
599 @dis:
600 0000000000000000: 5d pop %rbp
601 @rdfa_output:
602 0: [0] error - %bpl or %bp is changed
603 return code: 1
604 ----------------------------------------------------------------------
605 @hex:
606 # pop %rsp
607 5c
608 @rval:
609 VALIDATOR: 0000000000000000: 5c pop %rsp
610 VALIDATOR: ERROR: Illegal assignment to RSP
611 VALIDATOR: Checking jump targets: 0 to 1
612 VALIDATOR: Checking that basic blocks are aligned
613 *** <input> IS UNSAFE ***
614 @dis:
615 0000000000000000: 5c pop %rsp
616 @rdfa_output:
617 0: [0] error - %spl or %sp is changed
618 return code: 1
619 ----------------------------------------------------------------------
620 @hex:
621 # pop %r15
622 41 5f
623 @rval:
624 VALIDATOR: 0000000000000000: 41 5f pop %r15
625 VALIDATOR: ERROR: Illegal to change the value of register RegR15
626 VALIDATOR: Checking jump targets: 0 to 2
627 VALIDATOR: Checking that basic blocks are aligned
628 *** <input> IS UNSAFE ***
629 @dis:
630 0000000000000000: 41 5f pop %r15
631 @rdfa_output:
632 0: [0] error - %r15 is changed
633 return code: 1
634 ----------------------------------------------------------------------
635 @hex:
636 # Memory accesses.
637 # mov %eax, %eax
638 89 c0 \\
639 # mov (%r15, %rax), %ebx
640 41 8b 1c 07
641 @rval:
642 VALIDATOR: Checking jump targets: 0 to 6
643 VALIDATOR: Checking that basic blocks are aligned
644 *** <input> is safe ***
645 @dis:
646 0000000000000000: 89 c0 mov %eax, %eax
647 0000000000000002: 41 8b 1c 07 mov %ebx, [%r15 +%rax*1]
648 @rdfa_output:
649 return code: 0
650 ----------------------------------------------------------------------
651 @hex:
652 # Test for a top-bit-set register.
653 # mov %r12d, %r12d
654 45 89 e4 \\
655 # mov (%r15, %r12), %ebx
656 43 8b 1c 27
657 @rval:
658 VALIDATOR: Checking jump targets: 0 to 7
659 VALIDATOR: Checking that basic blocks are aligned
660 *** <input> is safe ***
661 @dis:
662 0000000000000000: 45 89 e4 mov %r12d, %r12 d
663 0000000000000003: 43 8b 1c 27 mov %ebx, [%r15 +%r12*1]
664 @rdfa_output:
665 return code: 0
666 ----------------------------------------------------------------------
667 @hex:
668 # Check %edi and %esi because the first 'mov' also begins superinstructions.
669 # mov %edi, %edi
670 89 ff \\
671 # mov (%r15, %rdi), %ebx
672 41 8b 1c 3f
673 @rval:
674 VALIDATOR: Checking jump targets: 0 to 6
675 VALIDATOR: Checking that basic blocks are aligned
676 *** <input> is safe ***
677 @dis:
678 0000000000000000: 89 ff mov %edi, %edi
679 0000000000000002: 41 8b 1c 3f mov %ebx, [%r15 +%rdi*1]
680 @rdfa_output:
681 return code: 0
682 ----------------------------------------------------------------------
683 @hex:
684 # mov %esi, %esi
685 89 f6 \\
686 # mov (%r15, %rsi), %ebx
687 41 8b 1c 37
688 @rval:
689 VALIDATOR: Checking jump targets: 0 to 6
690 VALIDATOR: Checking that basic blocks are aligned
691 *** <input> is safe ***
692 @dis:
693 0000000000000000: 89 f6 mov %esi, %esi
694 0000000000000002: 41 8b 1c 37 mov %ebx, [%r15 +%rsi*1]
695 @rdfa_output:
696 return code: 0
697 ----------------------------------------------------------------------
698 @hex:
699 # Check mask on its own.
700 # mov %eax, %eax
701 89 c0
702 @rval:
703 VALIDATOR: Checking jump targets: 0 to 2
704 VALIDATOR: Checking that basic blocks are aligned
705 *** <input> is safe ***
706 @dis:
707 0000000000000000: 89 c0 mov %eax, %eax
708 @rdfa_output:
709 return code: 0
710 ----------------------------------------------------------------------
711 @hex:
712 # mov (%r15, %rax), %ebx
713 41 8b 1c 07
714 @rval:
715 VALIDATOR: 0000000000000000: 41 8b 1c 07 mov %ebx, [%r15+%rax*1]
716 VALIDATOR: ERROR: Invalid index register in memory offset
717 VALIDATOR: Checking jump targets: 0 to 4
718 VALIDATOR: Checking that basic blocks are aligned
719 *** <input> IS UNSAFE ***
720 @dis:
721 0000000000000000: 41 8b 1c 07 mov %ebx, [%r15 +%rax*1]
722 @rdfa_output:
723 0: [0] improper memory address - bad index
724 return code: 1
725 ----------------------------------------------------------------------
726 @hex:
727 # mov %eax, %eax
728 89 c0
729 # mov (%r15, %rax), %ebx
730 41 8b 1c 07
731 # jmp .-4
732 eb fa
733 @rval:
734 VALIDATOR: Checking jump targets: 0 to 8
735 VALIDATOR: ERROR: 2: Bad jump target
736 VALIDATOR: Checking that basic blocks are aligned
737 *** <input> IS UNSAFE ***
738 @dis:
739 0000000000000000: 89 c0 mov %eax, %eax
740 0000000000000002: 41 8b 1c 07 mov %ebx, [%r15 +%rax*1]
741 0000000000000006: eb fa jmp 0x2
742 @rdfa_output:
743 6: [0] bad jump target
744 return code: 1
745 @validators_disagree:
746 Difference in jump reporting.
747 ----------------------------------------------------------------------
748 @hex:
749 # Check that post-conditions do not leak from a superinstruction. In the
750 # PyDFA validator, to share DFT states, the first instruction of the
751 # nacljmp, "and $~31, %eax", records a post-condition, just as when it is
752 # used on its own. Although the code below is safe, we don't really want
753 # the post-condition to leak through.
754 # and $~31, %eax
755 83 e0 e0
756 # add %r15, %rax
757 4c 01 f8
758 # jmp *%rax
759 ff e0
760 # %rax should not be regarded as zero-extended here.
761 # mov (%r15, %rax), %ebx
762 41 8b 1c 07
763 @rval:
764 VALIDATOR: 0000000000000008: 41 8b 1c 07 mov %ebx, [%r15+%rax*1]
765 VALIDATOR: ERROR: Invalid index register in memory offset
766 VALIDATOR: Checking jump targets: 0 to c
767 VALIDATOR: Checking that basic blocks are aligned
768 *** <input> IS UNSAFE ***
769 @dis:
770 0000000000000000: 83 e0 e0 and %eax, 0xe0
771 0000000000000003: 4c 01 f8 add %rax, %r15
772 0000000000000006: ff e0 jmp %rax
773 0000000000000008: 41 8b 1c 07 mov %ebx, [%r15 +%rax*1]
774 @rdfa_output:
775 8: [0] improper memory address - bad index
776 return code: 1
777 ----------------------------------------------------------------------
778 @hex:
779 # mov %edi, %edi
780 89 ff
781 # lea (%r15, %rdi), %rdi
782 49 8d 3c 3f
783 # rep stos %al, %es:(%rdi)
784 f3 aa
785 # %rdi should not be regarded as zero-extended here.
786 # mov (%r15, %rdi), %ebx
787 41 8b 1c 3f
788 @rval:
789 VALIDATOR: 0000000000000008: 41 8b 1c 3f mov %ebx, [%r15+%rdi*1]
790 VALIDATOR: ERROR: Invalid index register in memory offset
791 VALIDATOR: Checking jump targets: 0 to c
792 VALIDATOR: Checking that basic blocks are aligned
793 *** <input> IS UNSAFE ***
794 @dis:
795 0000000000000000: 89 ff mov %edi, %edi
796 0000000000000002: 49 8d 3c 3f lea %rdi, [%r15 +%rdi*1]
797 0000000000000006: f3 aa stosb [%rdi]
798 0000000000000008: 41 8b 1c 3f mov %ebx, [%r15 +%rdi*1]
799 @rdfa_output:
800 8: [0] improper memory address - bad index
801 return code: 1
802 ----------------------------------------------------------------------
803 @hex:
804 # mov %esi, %esi
805 89 f6
806 # lea (%r15, %rsi), %rsi
807 49 8d 34 37
808 # mov %edi, %edi
809 89 ff
810 # lea (%r15, %rdi), %rdi
811 49 8d 3c 3f
812 # rep movsb %ds:(%rsi), %es:(%rdi)
813 f3 a4
814 # %rsi should not be regarded as zero-extended here.
815 # mov (%r15, %rsi), %ebx
816 41 8b 1c 37
817 @rval:
818 VALIDATOR: 000000000000000e: 41 8b 1c 37 mov %ebx, [%r15+%rsi*1]
819 VALIDATOR: ERROR: Invalid index register in memory offset
820 VALIDATOR: Checking jump targets: 0 to 12
821 VALIDATOR: Checking that basic blocks are aligned
822 *** <input> IS UNSAFE ***
823 @dis:
824 0000000000000000: 89 f6 mov %esi, %esi
825 0000000000000002: 49 8d 34 37 lea %rsi, [%r15 +%rsi*1]
826 0000000000000006: 89 ff mov %edi, %edi
827 0000000000000008: 49 8d 3c 3f lea %rdi, [%r15 +%rdi*1]
828 000000000000000c: f3 a4 movsb [%rdi], [ %rsi]
829 000000000000000e: 41 8b 1c 37 mov %ebx, [%r15 +%rsi*1]
830 @rdfa_output:
831 e: [0] improper memory address - bad index
832 return code: 1
833 ----------------------------------------------------------------------
834 @hex:
835 # Non-%r15-based memory accesses.
836 # mov 0x1234(%rip), %eax
837 8b 05 34 12 00 00
838 # mov 0x1234(%rsp), %eax
839 8b 84 24 34 12 00 00
840 # mov 0x1234(%rbp), %eax
841 8b 85 34 12 00 00
842 @rval:
843 VALIDATOR: Checking jump targets: 0 to 13
844 VALIDATOR: Checking that basic blocks are aligned
845 *** <input> is safe ***
846 @dis:
847 0000000000000000: 8b 05 34 12 00 00 mov %eax, [%rip +0x1234]
848 0000000000000006: 8b 84 24 34 12 00 00 mov %eax, [%rsp +0x1234]
849 000000000000000d: 8b 85 34 12 00 00 mov %eax, [%rbp +0x1234]
850 @rdfa_output:
851 return code: 0
852 ----------------------------------------------------------------------
853 @hex:
854 # mov 0x1234(%rsp, %rbx), %eax
855 8b 84 1c 34 12 00 00
856 @rval:
857 VALIDATOR: 0000000000000000: 8b 84 1c 34 12 00 00 mov %eax, [%rsp+%rbx*1+0x1234]
858 VALIDATOR: ERROR: Invalid index register in memory offset
859 VALIDATOR: Checking jump targets: 0 to 7
860 VALIDATOR: Checking that basic blocks are aligned
861 *** <input> IS UNSAFE ***
862 @dis:
863 0000000000000000: 8b 84 1c 34 12 00 00 mov %eax, [%rsp +%rbx*1+0x1234]
864 @rdfa_output:
865 0: [0] improper memory address - bad index
866 return code: 1
867 ----------------------------------------------------------------------
868 @hex:
869 # mov 0x1234(%rbp, %rbx), %eax
870 8b 84 1d 34 12 00 00
871 @rval:
872 VALIDATOR: 0000000000000000: 8b 84 1d 34 12 00 00 mov %eax, [%rbp+%rbx*1+0x1234]
873 VALIDATOR: ERROR: Invalid index register in memory offset
874 VALIDATOR: Checking jump targets: 0 to 7
875 VALIDATOR: Checking that basic blocks are aligned
876 *** <input> IS UNSAFE ***
877 @dis:
878 0000000000000000: 8b 84 1d 34 12 00 00 mov %eax, [%rbp +%rbx*1+0x1234]
879 @rdfa_output:
880 0: [0] improper memory address - bad index
881 return code: 1
882 ----------------------------------------------------------------------
883 @hex:
884 # mov %ebx, %ebx
885 89 db \\
886 # mov 0x1234(%rsp, %rbx), %eax
887 8b 84 1c 34 12 00 00
888 @rval:
889 VALIDATOR: Checking jump targets: 0 to 9
890 VALIDATOR: Checking that basic blocks are aligned
891 *** <input> is safe ***
892 @dis:
893 0000000000000000: 89 db mov %ebx, %ebx
894 0000000000000002: 8b 84 1c 34 12 00 00 mov %eax, [%rsp +%rbx*1+0x1234]
895 @rdfa_output:
896 return code: 0
897 ----------------------------------------------------------------------
898 @hex:
899 # mov %ebx, %ebx
900 89 db \\
901 # mov 0x1234(%rbp, %rbx), %eax
902 8b 84 1d 34 12 00 00
903 @rval:
904 VALIDATOR: Checking jump targets: 0 to 9
905 VALIDATOR: Checking that basic blocks are aligned
906 *** <input> is safe ***
907 @dis:
908 0000000000000000: 89 db mov %ebx, %ebx
909 0000000000000002: 8b 84 1d 34 12 00 00 mov %eax, [%rbp +%rbx*1+0x1234]
910 @rdfa_output:
911 return code: 0
912 ----------------------------------------------------------------------
913 @hex:
914 # 'lea' is not a memory access.
915 # lea (%rbx, %rcx, 4), %rax
916 48 8d 04 8b
917 @rval:
918 VALIDATOR: Checking jump targets: 0 to 4
919 VALIDATOR: Checking that basic blocks are aligned
920 *** <input> is safe ***
921 @dis:
922 0000000000000000: 48 8d 04 8b lea %rax, [%rbx +%rcx*4]
923 @rdfa_output:
924 return code: 0
925 ----------------------------------------------------------------------
926 @hex:
927 # Stack operations.
928 # mov %rsp, %rbp
929 48 89 e5
930 # mov %rbp, %rsp
931 48 89 ec
932 @rval:
933 VALIDATOR: Checking jump targets: 0 to 6
934 VALIDATOR: Checking that basic blocks are aligned
935 *** <input> is safe ***
936 @dis:
937 0000000000000000: 48 89 e5 mov %rbp, %rsp
938 0000000000000003: 48 89 ec mov %rsp, %rbp
939 @rdfa_output:
940 return code: 0
941 ----------------------------------------------------------------------
942 @hex:
943 # add $8, %ebp
944 83 c5 08 \\
945 # add %r15, %rbp
946 4c 01 fd
947 @rval:
948 VALIDATOR: Checking jump targets: 0 to 6
949 VALIDATOR: Checking that basic blocks are aligned
950 *** <input> is safe ***
951 @dis:
952 0000000000000000: 83 c5 08 add %ebp, 0x8
953 0000000000000003: 4c 01 fd add %rbp, %r15
954 @rdfa_output:
955 return code: 0
956 ----------------------------------------------------------------------
957 @hex:
958 # add $8, %ebp
959 83 c5 08
960 # add %r15, %rbp
961 4c 01 fd
962 # jmp .-3
963 eb fb
964 @rval:
965 VALIDATOR: Checking jump targets: 0 to 8
966 VALIDATOR: ERROR: 3: Bad jump target
967 VALIDATOR: Checking that basic blocks are aligned
968 *** <input> IS UNSAFE ***
969 @dis:
970 0000000000000000: 83 c5 08 add %ebp, 0x8
971 0000000000000003: 4c 01 fd add %rbp, %r15
972 0000000000000006: eb fb jmp 0x3
973 @rdfa_output:
974 6: [0] bad jump target
975 return code: 1
976 @validators_disagree:
977 Difference in jump reporting.
978 ----------------------------------------------------------------------
979 @hex:
980 # A stack fixup on its own is not allowed.
981 # add %r15, %rbp
982 4c 01 fd
983 @rval:
984 VALIDATOR: 0000000000000000: 4c 01 fd add %rbp, %r15
985 VALIDATOR: ERROR: Illegal change to register RBP
986 VALIDATOR: Checking jump targets: 0 to 3
987 VALIDATOR: Checking that basic blocks are aligned
988 *** <input> IS UNSAFE ***
989 @dis:
990 0000000000000000: 4c 01 fd add %rbp, %r15
991 @rdfa_output:
992 0: [0] improper %rbp sandboxing
993 return code: 1
994 ----------------------------------------------------------------------
995 @hex:
996 # add %r15, %rsp
997 4c 01 fc
998 @rval:
999 VALIDATOR: 0000000000000000: 4c 01 fc add %rsp, %r15
1000 VALIDATOR: ERROR: Illegal assignment to RSP
1001 VALIDATOR: Checking jump targets: 0 to 3
1002 VALIDATOR: Checking that basic blocks are aligned
1003 *** <input> IS UNSAFE ***
1004 @dis:
1005 0000000000000000: 4c 01 fc add %rsp, %r15
1006 @rdfa_output:
1007 0: [0] improper %rsp sandboxing
1008 return code: 1
1009 ----------------------------------------------------------------------
1010 @hex:
1011 # add %r15, %r15
1012 4d 01 ff
1013 @rval:
1014 VALIDATOR: 0000000000000000: 4d 01 ff add %r15, %r15
1015 VALIDATOR: ERROR: Illegal to change the value of register RegR15
1016 VALIDATOR: Checking jump targets: 0 to 3
1017 VALIDATOR: Checking that basic blocks are aligned
1018 *** <input> IS UNSAFE ***
1019 @dis:
1020 0000000000000000: 4d 01 ff add %r15, %r15
1021 @rdfa_output:
1022 0: [0] error - %r15 is changed
1023 return code: 1
1024 ----------------------------------------------------------------------
1025 @hex:
1026 # Sandboxing is not required on prefetch instructions.
1027 # prefetchnta (%rax)
1028 0f 18 00
1029 @rval:
1030 VALIDATOR: Checking jump targets: 0 to 3
1031 VALIDATOR: Checking that basic blocks are aligned
1032 *** <input> is safe ***
1033 @dis:
1034 0000000000000000: 0f 18 00 prefetchnta [%r ax]
1035 @rdfa_output:
1036 return code: 0
1037 ----------------------------------------------------------------------
1038 @hex:
1039 # Segment register manipulations are forbidden
1040 # mov %rax, %es
1041 48 8e c0
1042 @rval:
1043 VALIDATOR: 0000000000000000: 48 8e c0 mov %es, %ax
1044 VALIDATOR: ERROR: This instruction has been marked illegal by Native Client
1045 VALIDATOR: 0000000000000000: 48 8e c0 mov %es, %ax
1046 VALIDATOR: ERROR: Illegal assignment to segment register RegES
1047 VALIDATOR: Checking jump targets: 0 to 3
1048 VALIDATOR: Checking that basic blocks are aligned
1049 *** <input> IS UNSAFE ***
1050 @dis:
1051 0000000000000000: 48 8e c0 mov %es, %ax
1052 @rdfa_output:
1053 0: [0] unrecognized instruction
1054 return code: 1
1055 ----------------------------------------------------------------------
1056 @hex:
1057 # mov %es, %rax
1058 48 8c c0
1059 @rval:
1060 VALIDATOR: 0000000000000000: 48 8c c0 mov %rax, %es
1061 VALIDATOR: ERROR: This instruction has been marked illegal by Native Client
1062 VALIDATOR: Checking jump targets: 0 to 3
1063 VALIDATOR: Checking that basic blocks are aligned
1064 *** <input> IS UNSAFE ***
1065 @dis:
1066 0000000000000000: 48 8c c0 mov %rax, %es
1067 @rdfa_output:
1068 0: [0] unrecognized instruction
1069 return code: 1
OLDNEW
« no previous file with comments | « src/trusted/validator_x86/testdata/64/test_insts.test ('k') | src/trusted/validator_x86/testdata/64/tzcnt.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698