Commit 4a1a6fb
committed
Fix stack walking in fixupWork() for frames with CFA padding
Running `hhvm hphp/test/quick/dv.php` on aarch64 with HHVM compiled in
release mode consistently segfaults while syncing the VM state prior to
producing a backtrace for a Hack exception (see gist).[1]
The crash happens because fixupWork assumes that aligned native frames
directly follow one another as it traverses the chain of frame pointers
while looking for the first VM frame, so it ends up using an incorrect
CFA for the reconstructed VM frame. In D29878492, @colavitam already warned us
of the perils inherent in this assumption and suggested using the unwinder instead.
Do this now.
The existing unwinder logic in unwind-itanium.cpp and co. doesn't seem
to be reusable here, since we're not unwinding the stack while handling
a C++ exception, but we should be able to use _Unwind_Backtrace() from
libgcc_s.so in a reasonably uncomplicated fashion.
Remove fixupWork() from fixup.h since it's now purely internal to the
implementation file.
[1] https://gist.github.com/mszabo-wikia/187833ee32cd5b6f4efa8bd987a66cd41 parent d43b5ed commit 4a1a6fb
2 files changed
+37
-40
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
| 28 | + | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
| |||
181 | 185 | | |
182 | 186 | | |
183 | 187 | | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
| 188 | + | |
| 189 | + | |
195 | 190 | | |
196 | | - | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
197 | 196 | | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
205 | 214 | | |
206 | | - | |
207 | 215 | | |
208 | | - | |
| 216 | + | |
209 | 217 | | |
210 | 218 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
216 | 224 | | |
217 | 225 | | |
218 | | - | |
219 | | - | |
220 | | - | |
| 226 | + | |
| 227 | + | |
221 | 228 | | |
222 | | - | |
223 | | - | |
224 | | - | |
| 229 | + | |
225 | 230 | | |
226 | | - | |
| 231 | + | |
227 | 232 | | |
228 | 233 | | |
229 | 234 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | 221 | | |
230 | 222 | | |
231 | 223 | | |
| |||
0 commit comments