Commit | Line | Data |
---|---|---|
bffbf940 JJ |
1 | /* Force .data aligned to 4K, so .got very likely gets at 0x102190 |
2 | (0x60 bytes .tdata and 0x130 bytes .dynamic) */ | |
3 | .data | |
4 | .balign 4096 | |
5 | .section ".tdata", "awT", @progbits | |
6 | .globl sg1, sg2, sg3, sg4, sg5, sg6, sg7, sg8 | |
7 | .globl sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8 | |
8 | .hidden sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8 | |
9 | sg1: .long 17 | |
10 | sg2: .long 18 | |
11 | sg3: .long 19 | |
12 | sg4: .long 20 | |
13 | sg5: .long 21 | |
14 | sg6: .long 22 | |
15 | sg7: .long 23 | |
16 | sg8: .long 24 | |
17 | sl1: .long 65 | |
18 | sl2: .long 66 | |
19 | sl3: .long 67 | |
20 | sl4: .long 68 | |
21 | sl5: .long 69 | |
22 | sl6: .long 70 | |
23 | sl7: .long 71 | |
24 | sl8: .long 72 | |
25 | sh1: .long 257 | |
26 | sh2: .long 258 | |
27 | sh3: .long 259 | |
28 | sh4: .long 260 | |
29 | sh5: .long 261 | |
30 | sh6: .long 262 | |
31 | sh7: .long 263 | |
32 | sh8: .long 264 | |
33 | /* Force .text aligned to 4K, so it very likely gets at 0x1000. */ | |
34 | .text | |
35 | .balign 4096 | |
36 | .globl fn1 | |
37 | .type fn1,@function | |
38 | fn1: | |
39 | pushq %rbp | |
40 | movq %rsp, %rbp | |
41 | nop;nop;nop;nop | |
42 | ||
43 | /* GD */ | |
44 | .long 0x66666666 | |
45 | leaq sg1@tlsgd(%rip), %rdi | |
46 | call __tls_get_addr@plt | |
47 | nop;nop;nop;nop | |
48 | ||
49 | /* GD -> IE because variable is referenced through IE too */ | |
50 | .long 0x66666666 | |
51 | leaq sg2@tlsgd(%rip), %rdi | |
52 | call __tls_get_addr@plt | |
53 | nop;nop;nop;nop | |
54 | ||
55 | /* GD against local variable */ | |
56 | .long 0x66666666 | |
57 | leaq sl1@tlsgd(%rip), %rdi | |
58 | call __tls_get_addr@plt | |
59 | nop;nop;nop;nop | |
60 | ||
61 | /* GD -> IE against local variable referenced through IE too */ | |
62 | .long 0x66666666 | |
63 | leaq sl2@tlsgd(%rip), %rdi | |
64 | call __tls_get_addr@plt | |
65 | nop;nop;nop;nop | |
66 | ||
67 | /* GD against hidden and local variable */ | |
68 | .long 0x66666666 | |
69 | leaq sh1@tlsgd(%rip), %rdi | |
70 | call __tls_get_addr@plt | |
71 | nop;nop;nop;nop | |
72 | ||
73 | /* GD -> IE against hidden and local variable referenced through | |
74 | IE too */ | |
75 | .long 0x66666666 | |
76 | leaq sh2@tlsgd(%rip), %rdi | |
77 | call __tls_get_addr@plt | |
78 | nop;nop;nop;nop | |
79 | ||
80 | /* GD against hidden but not local variable */ | |
81 | .long 0x66666666 | |
82 | leaq sH1@tlsgd(%rip), %rdi | |
83 | call __tls_get_addr@plt | |
84 | nop;nop;nop;nop | |
85 | ||
86 | /* GD -> IE against hidden but not local variable referenced through | |
87 | IE too */ | |
88 | .long 0x66666666 | |
89 | leaq sH2@tlsgd(%rip), %rdi | |
90 | call __tls_get_addr@plt | |
91 | nop;nop;nop;nop | |
92 | ||
93 | /* LD */ | |
94 | leaq sl1@tlsld(%rip), %rdi | |
95 | call __tls_get_addr@plt | |
96 | nop;nop | |
97 | leaq sl1@dtpoff(%rax), %rdx | |
98 | nop;nop | |
99 | leaq 2+sl2@dtpoff(%rax), %r9 | |
100 | nop;nop;nop;nop | |
101 | ||
102 | /* LD against hidden and local variables */ | |
103 | leaq sh1@tlsld(%rip), %rdi | |
104 | call __tls_get_addr@plt | |
105 | nop;nop | |
106 | leaq sh1@dtpoff(%rax), %rdx | |
107 | nop;nop | |
108 | leaq sh2@dtpoff+3(%rax), %rcx | |
109 | nop;nop;nop;nop | |
110 | ||
111 | /* LD against hidden but not local variables */ | |
112 | leaq sH1@tlsld(%rip), %rdi | |
113 | call __tls_get_addr@plt | |
114 | nop;nop | |
115 | leaq sH1@dtpoff(%rax), %r12 | |
116 | nop;nop | |
117 | leaq sH2@dtpoff+1(%rax), %rcx | |
118 | nop;nop | |
119 | ||
120 | /* IE against global var */ | |
121 | movq %fs:0, %rcx | |
122 | nop;nop | |
123 | addq sg2@gottpoff(%rip), %rcx | |
124 | nop;nop;nop;nop | |
125 | ||
126 | /* IE against local var */ | |
127 | movq %fs:0, %r14 | |
128 | nop;nop | |
129 | addq sl2@gottpoff(%rip), %r14 | |
130 | nop;nop;nop;nop | |
131 | ||
132 | /* IE against hidden and local var */ | |
133 | movq %fs:0, %rcx | |
134 | nop;nop | |
135 | addq sh2@gottpoff(%rip), %rcx | |
136 | nop;nop;nop;nop | |
137 | ||
138 | /* IE against hidden but not local var */ | |
139 | movq %fs:0, %rcx | |
140 | nop;nop | |
141 | addq sH2@gottpoff(%rip), %rcx | |
142 | nop;nop;nop;nop | |
143 | ||
144 | /* Direct access through %fs */ | |
145 | ||
146 | /* IE against global var */ | |
147 | movq sg5@gottpoff(%rip), %rcx | |
148 | nop;nop | |
149 | movq %fs:(%rcx), %rdx | |
150 | nop;nop;nop;nop | |
151 | ||
152 | /* IE against local var */ | |
153 | movq sl5@gottpoff(%rip), %r10 | |
154 | nop;nop | |
155 | movq %fs:(%r10), %r12 | |
156 | nop;nop;nop;nop | |
157 | ||
158 | /* IE against hidden and local var */ | |
159 | movq sh5@gottpoff(%rip), %rdx | |
160 | nop;nop | |
161 | movq %fs:(%rdx), %rdx | |
162 | nop;nop;nop;nop | |
163 | ||
164 | /* IE against hidden but not local var */ | |
165 | movq sH5@gottpoff(%rip), %rcx | |
166 | nop;nop | |
167 | movq %fs:(%rcx), %rdx | |
168 | nop;nop;nop;nop | |
169 | ||
170 | leave | |
171 | ret |