1 #include "sanitizer_common/sanitizer_asm.h" 2 .section .text 3 4 .hidden __tsan_setjmp 5 .comm _ZN14__interception11real_setjmpE,8,8 6 .type setjmp, @function 7 setjmp: 8 CFI_STARTPROC 9 10 // save env parameters for function call 11 stp x29, x30, [sp, -32]! 12 CFI_DEF_CFA_OFFSET (32) 13 CFI_OFFSET (29, -32) 14 CFI_OFFSET (30, -24) 15 16 // Adjust the SP for previous frame 17 add x29, sp, 0 18 CFI_DEF_CFA_REGISTER (29) 19 20 // Save jmp_buf 21 str x19, [sp, 16] 22 CFI_OFFSET (19, -16) 23 mov x19, x0 24 25 // SP pointer mangling (see glibc setjmp) 26 adrp x2, :got:__pointer_chk_guard 27 ldr x2, [x2, #:got_lo12:__pointer_chk_guard] 28 add x0, x29, 32 29 ldr x2, [x2] 30 eor x1, x2, x0 31 32 // call tsan interceptor 33 bl __tsan_setjmp 34 35 // restore env parameter 36 mov x0, x19 37 ldr x19, [sp, 16] 38 ldp x29, x30, [sp], 32 39 CFI_RESTORE (30) 40 CFI_RESTORE (19) 41 CFI_DEF_CFA (31, 0) 42 43 // tail jump to libc setjmp 44 adrp x1, :got:_ZN14__interception11real_setjmpE 45 ldr x1, [x1, #:got_lo12:_ZN14__interception11real_setjmpE] 46 ldr x1, [x1] 47 br x1 48 49 CFI_ENDPROC 50 .size setjmp, .-setjmp 51 52 .comm _ZN14__interception12real__setjmpE,8,8 53 .globl _setjmp 54 .type _setjmp, @function 55 _setjmp: 56 CFI_STARTPROC 57 58 // save env parameters for function call 59 stp x29, x30, [sp, -32]! 60 CFI_DEF_CFA_OFFSET (32) 61 CFI_OFFSET (29, -32) 62 CFI_OFFSET (30, -24) 63 64 // Adjust the SP for previous frame 65 add x29, sp, 0 66 CFI_DEF_CFA_REGISTER (29) 67 68 // Save jmp_buf 69 str x19, [sp, 16] 70 CFI_OFFSET (19, -16) 71 mov x19, x0 72 73 // SP pointer mangling (see glibc setjmp) 74 adrp x2, :got:__pointer_chk_guard 75 ldr x2, [x2, #:got_lo12:__pointer_chk_guard] 76 add x0, x29, 32 77 ldr x2, [x2] 78 eor x1, x2, x0 79 80 // call tsan interceptor 81 bl __tsan_setjmp 82 83 // Restore jmp_buf parameter 84 mov x0, x19 85 ldr x19, [sp, 16] 86 ldp x29, x30, [sp], 32 87 CFI_RESTORE (30) 88 CFI_RESTORE (19) 89 CFI_DEF_CFA (31, 0) 90 91 // tail jump to libc setjmp 92 adrp x1, :got:_ZN14__interception12real__setjmpE 93 ldr x1, [x1, #:got_lo12:_ZN14__interception12real__setjmpE] 94 ldr x1, [x1] 95 br x1 96 97 CFI_ENDPROC 98 .size _setjmp, .-_setjmp 99 100 .comm _ZN14__interception14real_sigsetjmpE,8,8 101 .globl sigsetjmp 102 .type sigsetjmp, @function 103 sigsetjmp: 104 CFI_STARTPROC 105 106 // save env parameters for function call 107 stp x29, x30, [sp, -32]! 108 CFI_DEF_CFA_OFFSET (32) 109 CFI_OFFSET (29, -32) 110 CFI_OFFSET (30, -24) 111 112 // Adjust the SP for previous frame 113 add x29, sp, 0 114 CFI_DEF_CFA_REGISTER (29) 115 116 // Save jmp_buf and savesigs 117 stp x19, x20, [sp, 16] 118 CFI_OFFSET (19, -16) 119 CFI_OFFSET (20, -8) 120 mov w20, w1 121 mov x19, x0 122 123 // SP pointer mangling (see glibc setjmp) 124 adrp x2, :got:__pointer_chk_guard 125 ldr x2, [x2, #:got_lo12:__pointer_chk_guard] 126 add x0, x29, 32 127 ldr x2, [x2] 128 eor x1, x2, x0 129 130 // call tsan interceptor 131 bl __tsan_setjmp 132 133 // restore env parameter 134 mov w1, w20 135 mov x0, x19 136 ldp x19, x20, [sp, 16] 137 ldp x29, x30, [sp], 32 138 CFI_RESTORE (30) 139 CFI_RESTORE (29) 140 CFI_RESTORE (19) 141 CFI_RESTORE (20) 142 CFI_DEF_CFA (31, 0) 143 144 // tail jump to libc sigsetjmp 145 adrp x2, :got:_ZN14__interception14real_sigsetjmpE 146 ldr x2, [x2, #:got_lo12:_ZN14__interception14real_sigsetjmpE] 147 ldr x2, [x2] 148 br x2 149 CFI_ENDPROC 150 .size sigsetjmp, .-sigsetjmp 151 152 .comm _ZN14__interception16real___sigsetjmpE,8,8 153 .globl __sigsetjmp 154 .type __sigsetjmp, @function 155 __sigsetjmp: 156 CFI_STARTPROC 157 158 // save env parameters for function call 159 stp x29, x30, [sp, -32]! 160 CFI_DEF_CFA_OFFSET (32) 161 CFI_OFFSET (29, -32) 162 CFI_OFFSET (30, -24) 163 164 // Adjust the SP for previous frame 165 add x29, sp, 0 166 CFI_DEF_CFA_REGISTER (29) 167 168 // Save jmp_buf and savesigs 169 stp x19, x20, [sp, 16] 170 CFI_OFFSET (19, -16) 171 CFI_OFFSET (20, -8) 172 mov w20, w1 173 mov x19, x0 174 175 // SP pointer mangling (see glibc setjmp) 176 adrp x2, :got:__pointer_chk_guard 177 ldr x2, [x2, #:got_lo12:__pointer_chk_guard] 178 add x0, x29, 32 179 ldr x2, [x2] 180 eor x1, x2, x0 181 182 // call tsan interceptor 183 bl __tsan_setjmp 184 185 mov w1, w20 186 mov x0, x19 187 ldp x19, x20, [sp, 16] 188 ldp x29, x30, [sp], 32 189 CFI_RESTORE (30) 190 CFI_RESTORE (29) 191 CFI_RESTORE (19) 192 CFI_RESTORE (20) 193 CFI_DEF_CFA (31, 0) 194 195 // tail jump to libc __sigsetjmp 196 adrp x2, :got:_ZN14__interception16real___sigsetjmpE 197 ldr x2, [x2, #:got_lo12:_ZN14__interception16real___sigsetjmpE] 198 ldr x2, [x2] 199 br x2 200 CFI_ENDPROC 201 .size __sigsetjmp, .-__sigsetjmp 202 203 #if defined(__linux__) 204 /* We do not need executable stack. */ 205 .section .note.GNU-stack,"",@progbits 206 #endif 207