1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
#include "sanitizer_common/sanitizer_asm.h"
.section .text
.comm _ZN14__interception11real_setjmpE,8,8
.globl ASM_SYMBOL_INTERCEPTOR(setjmp)
ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(setjmp))
ASM_SYMBOL_INTERCEPTOR(setjmp):
CFI_STARTPROC
// Save frame pointer and return address register
addi sp, sp, -32
sd ra, 24(sp)
sd s0, 16(sp)
CFI_DEF_CFA_OFFSET (32)
CFI_OFFSET (1, -8)
CFI_OFFSET (8, -16)
// Adjust the SP for previous frame
addi s0, sp, 32
CFI_DEF_CFA_REGISTER (8)
// Save env parameter
sd a0, 8(sp)
CFI_OFFSET (10, -24)
// Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
addi a0, s0, 0
// call tsan interceptor
call ASM_SYMBOL(__tsan_setjmp)
// Restore env parameter
ld a0, 8(sp)
CFI_RESTORE (10)
// Restore frame/link register
ld s0, 16(sp)
ld ra, 24(sp)
addi sp, sp, 32
CFI_RESTORE (8)
CFI_RESTORE (1)
CFI_DEF_CFA (2, 0)
// tail jump to libc setjmp
la t1, _ZN14__interception11real_setjmpE
ld t1, 0(t1)
jr t1
CFI_ENDPROC
ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(setjmp))
.comm _ZN14__interception12real__setjmpE,8,8
.globl ASM_SYMBOL_INTERCEPTOR(_setjmp)
ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(_setjmp))
ASM_SYMBOL_INTERCEPTOR(_setjmp):
CFI_STARTPROC
// Save frame pointer and return address register
addi sp, sp, -32
sd ra, 24(sp)
sd s0, 16(sp)
CFI_DEF_CFA_OFFSET (32)
CFI_OFFSET (1, -8)
CFI_OFFSET (8, -16)
// Adjust the SP for previous frame
addi s0, sp, 32
CFI_DEF_CFA_REGISTER (8)
// Save env parameter
sd a0, 8(sp)
CFI_OFFSET (10, -24)
// Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
addi a0, s0, 0
// call tsan interceptor
call ASM_SYMBOL(__tsan_setjmp)
// Restore env parameter
ld a0, 8(sp)
CFI_RESTORE (10)
// Restore frame/link register
ld s0, 16(sp)
ld ra, 24(sp)
addi sp, sp, 32
CFI_RESTORE (8)
CFI_RESTORE (1)
CFI_DEF_CFA (2, 0)
// tail jump to libc setjmp
la t1, _ZN14__interception12real__setjmpE
ld t1, 0(t1)
jr t1
CFI_ENDPROC
ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(_setjmp))
.comm _ZN14__interception14real_sigsetjmpE,8,8
.globl ASM_SYMBOL_INTERCEPTOR(sigsetjmp)
ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(sigsetjmp))
ASM_SYMBOL_INTERCEPTOR(sigsetjmp):
CFI_STARTPROC
// Save frame pointer and return address register
addi sp, sp, -32
sd ra, 24(sp)
sd s0, 16(sp)
CFI_DEF_CFA_OFFSET (32)
CFI_OFFSET (1, -8)
CFI_OFFSET (8, -16)
// Adjust the SP for previous frame
addi s0, sp, 32
CFI_DEF_CFA_REGISTER (8)
// Save env parameter
sd a0, 8(sp)
sd a1, 0(sp)
CFI_OFFSET (10, -24)
CFI_OFFSET (11, -32)
// Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
addi a0, s0, 0
// call tsan interceptor
call ASM_SYMBOL(__tsan_setjmp)
// Restore env parameter
ld a0, 8(sp)
ld a1, 0(sp)
CFI_RESTORE (10)
CFI_RESTORE (11)
// Restore frame/link register
ld s0, 16(sp)
ld ra, 24(sp)
addi sp, sp, 32
CFI_RESTORE (8)
CFI_RESTORE (1)
CFI_DEF_CFA (2, 0)
// tail jump to libc setjmp
la t1, _ZN14__interception14real_sigsetjmpE
ld t1, 0(t1)
jr t1
CFI_ENDPROC
ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(sigsetjmp))
.comm _ZN14__interception16real___sigsetjmpE,8,8
.globl ASM_SYMBOL_INTERCEPTOR(__sigsetjmp)
ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp))
ASM_SYMBOL_INTERCEPTOR(__sigsetjmp):
CFI_STARTPROC
// Save frame pointer and return address register
addi sp, sp, -32
sd ra, 24(sp)
sd s0, 16(sp)
CFI_DEF_CFA_OFFSET (32)
CFI_OFFSET (1, -8)
CFI_OFFSET (8, -16)
// Adjust the SP for previous frame
addi s0, sp, 32
CFI_DEF_CFA_REGISTER (8)
// Save env parameter
sd a0, 8(sp)
sd a1, 0(sp)
CFI_OFFSET (10, -24)
CFI_OFFSET (11, -32)
// Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
addi a0, s0, 0
// call tsan interceptor
call ASM_SYMBOL(__tsan_setjmp)
// Restore env parameter
ld a0, 8(sp)
ld a1, 0(sp)
CFI_RESTORE (10)
CFI_RESTORE (11)
// Restore frame/link register
ld s0, 16(sp)
ld ra, 24(sp)
addi sp, sp, 32
CFI_RESTORE (8)
CFI_RESTORE (1)
CFI_DEF_CFA (2, 0)
// tail jump to libc setjmp
la t1, _ZN14__interception16real___sigsetjmpE
ld t1, 0(t1)
jr t1
CFI_ENDPROC
ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp))
|