| 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 |
.byte 0x66 |
| 45 |
leaq sg1@tlsgd(%rip), %rdi |
| 46 |
.word 0x6666 |
| 47 |
rex64 |
| 48 |
call __tls_get_addr@plt |
| 49 |
nop;nop;nop;nop |
| 50 |
|
| 51 |
/* GD -> IE because variable is referenced through IE too */ |
| 52 |
.byte 0x66 |
| 53 |
leaq sg2@tlsgd(%rip), %rdi |
| 54 |
.word 0x6666 |
| 55 |
rex64 |
| 56 |
call __tls_get_addr@plt |
| 57 |
nop;nop;nop;nop |
| 58 |
|
| 59 |
/* GD against local variable */ |
| 60 |
.byte 0x66 |
| 61 |
leaq sl1@tlsgd(%rip), %rdi |
| 62 |
.word 0x6666 |
| 63 |
rex64 |
| 64 |
call __tls_get_addr@plt |
| 65 |
nop;nop;nop;nop |
| 66 |
|
| 67 |
/* GD -> IE against local variable referenced through IE too */ |
| 68 |
.byte 0x66 |
| 69 |
leaq sl2@tlsgd(%rip), %rdi |
| 70 |
.word 0x6666 |
| 71 |
rex64 |
| 72 |
call __tls_get_addr@plt |
| 73 |
nop;nop;nop;nop |
| 74 |
|
| 75 |
/* GD against hidden and local variable */ |
| 76 |
.byte 0x66 |
| 77 |
leaq sh1@tlsgd(%rip), %rdi |
| 78 |
.word 0x6666 |
| 79 |
rex64 |
| 80 |
call __tls_get_addr@plt |
| 81 |
nop;nop;nop;nop |
| 82 |
|
| 83 |
/* GD -> IE against hidden and local variable referenced through |
| 84 |
IE too */ |
| 85 |
.byte 0x66 |
| 86 |
leaq sh2@tlsgd(%rip), %rdi |
| 87 |
.word 0x6666 |
| 88 |
rex64 |
| 89 |
call __tls_get_addr@plt |
| 90 |
nop;nop;nop;nop |
| 91 |
|
| 92 |
/* GD against hidden but not local variable */ |
| 93 |
.byte 0x66 |
| 94 |
leaq sH1@tlsgd(%rip), %rdi |
| 95 |
.word 0x6666 |
| 96 |
rex64 |
| 97 |
call __tls_get_addr@plt |
| 98 |
nop;nop;nop;nop |
| 99 |
|
| 100 |
/* GD -> IE against hidden but not local variable referenced through |
| 101 |
IE too */ |
| 102 |
.byte 0x66 |
| 103 |
leaq sH2@tlsgd(%rip), %rdi |
| 104 |
.word 0x6666 |
| 105 |
rex64 |
| 106 |
call __tls_get_addr@plt |
| 107 |
nop;nop;nop;nop |
| 108 |
|
| 109 |
/* LD */ |
| 110 |
leaq sl1@tlsld(%rip), %rdi |
| 111 |
call __tls_get_addr@plt |
| 112 |
nop;nop |
| 113 |
leaq sl1@dtpoff(%rax), %rdx |
| 114 |
nop;nop |
| 115 |
leaq 2+sl2@dtpoff(%rax), %r9 |
| 116 |
nop;nop;nop;nop |
| 117 |
|
| 118 |
/* LD against hidden and local variables */ |
| 119 |
leaq sh1@tlsld(%rip), %rdi |
| 120 |
call __tls_get_addr@plt |
| 121 |
nop;nop |
| 122 |
leaq sh1@dtpoff(%rax), %rdx |
| 123 |
nop;nop |
| 124 |
leaq sh2@dtpoff+3(%rax), %rcx |
| 125 |
nop;nop;nop;nop |
| 126 |
|
| 127 |
/* LD against hidden but not local variables */ |
| 128 |
leaq sH1@tlsld(%rip), %rdi |
| 129 |
call __tls_get_addr@plt |
| 130 |
nop;nop |
| 131 |
leaq sH1@dtpoff(%rax), %r12 |
| 132 |
nop;nop |
| 133 |
leaq sH2@dtpoff+1(%rax), %rcx |
| 134 |
nop;nop |
| 135 |
|
| 136 |
/* IE against global var */ |
| 137 |
movq %fs:0, %rcx |
| 138 |
nop;nop |
| 139 |
addq sg2@gottpoff(%rip), %rcx |
| 140 |
nop;nop;nop;nop |
| 141 |
|
| 142 |
/* IE against local var */ |
| 143 |
movq %fs:0, %r14 |
| 144 |
nop;nop |
| 145 |
addq sl2@gottpoff(%rip), %r14 |
| 146 |
nop;nop;nop;nop |
| 147 |
|
| 148 |
/* IE against hidden and local var */ |
| 149 |
movq %fs:0, %rcx |
| 150 |
nop;nop |
| 151 |
addq sh2@gottpoff(%rip), %rcx |
| 152 |
nop;nop;nop;nop |
| 153 |
|
| 154 |
/* IE against hidden but not local var */ |
| 155 |
movq %fs:0, %rcx |
| 156 |
nop;nop |
| 157 |
addq sH2@gottpoff(%rip), %rcx |
| 158 |
nop;nop;nop;nop |
| 159 |
|
| 160 |
/* Direct access through %fs */ |
| 161 |
|
| 162 |
/* IE against global var */ |
| 163 |
movq sg5@gottpoff(%rip), %rcx |
| 164 |
nop;nop |
| 165 |
movq %fs:(%rcx), %rdx |
| 166 |
nop;nop;nop;nop |
| 167 |
|
| 168 |
/* IE against local var */ |
| 169 |
movq sl5@gottpoff(%rip), %r10 |
| 170 |
nop;nop |
| 171 |
movq %fs:(%r10), %r12 |
| 172 |
nop;nop;nop;nop |
| 173 |
|
| 174 |
/* IE against hidden and local var */ |
| 175 |
movq sh5@gottpoff(%rip), %rdx |
| 176 |
nop;nop |
| 177 |
movq %fs:(%rdx), %rdx |
| 178 |
nop;nop;nop;nop |
| 179 |
|
| 180 |
/* IE against hidden but not local var */ |
| 181 |
movq sH5@gottpoff(%rip), %rcx |
| 182 |
nop;nop |
| 183 |
movq %fs:(%rcx), %rdx |
| 184 |
nop;nop;nop;nop |
| 185 |
|
| 186 |
leave |
| 187 |
ret |