1 /* Force .data aligned to 4K, so that .got very likely gets at 2 0x5021a0 (0x60 bytes .tdata and 0x140 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 9sg1: .long 17 10sg2: .long 18 11sg3: .long 19 12sg4: .long 20 13sg5: .long 21 14sg6: .long 22 15sg7: .long 23 16sg8: .long 24 17sl1: .long 65 18sl2: .long 66 19sl3: .long 67 20sl4: .long 68 21sl5: .long 69 22sl6: .long 70 23sl7: .long 71 24sl8: .long 72 25sh1: .long 257 26sh2: .long 258 27sh3: .long 259 28sh4: .long 260 29sh5: .long 261 30sh6: .long 262 31sh7: .long 263 32sh8: .long 264 33 /* Force .text aligned to 4K, so it very likely gets at 0x401000. */ 34 .text 35 .balign 4096 36 .globl fn2 37 .type fn2,@function 38fn2: 39 pushq %rbp 40 movq %rsp, %rbp 41 42 /* GD -> IE because variable is not defined in executable */ 43 leaq sG1@tlsdesc(%rip), %rax 44 call *sG1@tlscall(%rax) 45 nop;nop;nop;nop 46 47 /* GD -> IE because variable is not defined in executable where 48 the variable is referenced through IE too */ 49 leaq sG2@tlsdesc(%rip), %rax 50 call *sG2@tlscall(%rax) 51 nop;nop;nop;nop 52 53 /* GD -> LE with global variable defined in executable */ 54 leaq sg1@tlsdesc(%rip), %rax 55 call *sg1@tlscall(%rax) 56 nop;nop;nop;nop 57 58 /* GD -> LE with local variable defined in executable */ 59 leaq sl1@tlsdesc(%rip), %rax 60 call *sl1@tlscall(%rax) 61 nop;nop;nop;nop 62 63 /* GD -> LE with hidden variable defined in executable */ 64 leaq sh1@tlsdesc(%rip), %rax 65 call *sh1@tlscall(%rax) 66 nop;nop;nop;nop 67 68 /* LD -> LE */ 69 leaq _TLS_MODULE_BASE_@tlsdesc(%rip), %rax 70 call *_TLS_MODULE_BASE_@tlscall(%rax) 71 nop;nop 72 leaq 1+sl1@dtpoff(%rax), %rdx 73 nop;nop 74 leaq sl2@dtpoff+2(%rax), %r9 75 nop;nop;nop;nop 76 77 /* LD -> LE against hidden variables */ 78 leaq sh1@dtpoff(%rax), %rdx 79 nop;nop 80 leaq 3+sh2@dtpoff(%rax), %rcx 81 nop;nop;nop;nop 82 83 /* IE against global var */ 84 movq %fs:0, %r9 85 nop;nop 86 addq sG2@gottpoff(%rip), %r9 87 nop;nop;nop;nop 88 89 /* IE -> LE against global var defined in exec */ 90 movq %fs:0, %r10 91 nop;nop 92 addq sg1@gottpoff(%rip), %r10 93 nop;nop;nop;nop 94 95 /* IE -> LE against local var */ 96 movq %fs:0, %rax 97 nop;nop 98 addq sl1@gottpoff(%rip), %rax 99 nop;nop;nop;nop 100 101 /* IE -> LE against hidden var */ 102 movq %fs:0, %rcx 103 nop;nop 104 addq sh1@gottpoff(%rip), %rcx 105 nop;nop;nop;nop 106 107 /* Direct access through %fs */ 108 109 /* IE against global var */ 110 movq sG5@gottpoff(%rip), %rcx 111 nop;nop 112 movq %fs:(%rcx), %rdx 113 nop;nop;nop;nop 114 115 /* IE->LE against local var */ 116 movq sl5@gottpoff(%rip), %r11 117 nop;nop 118 movq %fs:(%r11), %r12 119 nop;nop;nop;nop 120 121 /* IE->LE against hidden var */ 122 movq sh5@gottpoff(%rip), %rdx 123 nop;nop 124 movq %fs:(%rdx), %rdx 125 nop;nop;nop;nop 126 127 leave 128 ret 129