2 # Test valid TLS access commands.
8 *** <input> is safe ***
10 00000000: 65 a1 00 00 00 00 mov %eax, %gs:[0x0]
11 00000006: 65 a1 04 00 00 00 mov %eax, %gs:[0x4]
14 ----------------------------------------------------------------------
16 # Access with something besides 'mov'
20 VALIDATOR: 0: Bad prefix usage
21 *** <input> IS UNSAFE ***
23 00000000: 65 03 05 00 00 00 00 add %eax, 0x0
25 0: [0] unrecognized instruction
27 ----------------------------------------------------------------------
34 # lock add %gs:0x0,%eax
35 65 F0 03 05 00 00 00 00
37 VALIDATOR: 0: Bad prefix usage
38 VALIDATOR: 7: Bad prefix usage
39 VALIDATOR: e: Bad prefix usage
40 *** <input> IS UNSAFE ***
42 00000000: 65 66 a1 00 00 00 00 mov %ax, %gs:[0x0]
43 00000007: 65 66 a3 00 00 00 00 mov %gs:[0x0], %ax
44 0000000e: 65 f0 03 05 00 00 00 00 invalid %eax, 0x0
46 0: [0] unrecognized instruction
47 7: [1] unrecognized instruction
48 e: [2] unrecognized instruction
50 ----------------------------------------------------------------------
62 VALIDATOR: 0: Bad prefix usage
63 VALIDATOR: 6: Bad prefix usage
64 VALIDATOR: c: Bad prefix usage
65 VALIDATOR: 13: Bad prefix usage
66 *** <input> IS UNSAFE ***
68 00000000: 64 a1 00 00 00 00 mov %eax, %fs:[0x0]
69 00000006: 64 a3 00 00 00 00 mov %fs:[0x0], %eax
70 0000000c: 64 66 a1 00 00 00 00 mov %ax, %fs:[0x0]
71 00000013: 64 66 a3 00 00 00 00 mov %fs:[0x0], %ax
73 0: [0] unrecognized instruction
74 6: [1] unrecognized instruction
75 c: [2] unrecognized instruction
76 13: [3] unrecognized instruction
78 ----------------------------------------------------------------------
80 # Can we write to gs segment?
84 *** <input> is safe ***
86 00000000: 65 a3 00 00 00 00 mov %gs:[0x0], %eax
88 0: [0] unrecognized instruction
91 gs segment should be read-only, but old validator does not enforce that.
92 See http://code.google.com/p/nativeclient/issues/detail?id=2250
93 ----------------------------------------------------------------------
95 # Fixed offsets besides 0 and 4
101 # Can we read from arbitrary offset?
105 *** <input> is safe ***
107 00000000: 65 a1 03 00 00 00 mov %eax, %gs:[0x3]
108 00000006: 65 a1 08 00 00 00 mov %eax, %gs:[0x8]
109 0000000c: 65 8b 00 mov %eax, %gs:[%eax]
111 0: [0] unrecognized instruction
112 6: [1] unrecognized instruction
113 c: [2] unrecognized instruction
115 @validators_disagree:
116 gs is only supposed to be read at offsets 0 and 4, but old validator does not
118 See http://code.google.com/p/nativeclient/issues/detail?id=2250