Skip to content

Commit 1d15be6

Browse files
committed
Explain why we need extra check in probestack.
1 parent 56293ad commit 1d15be6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/probestack.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ pub unsafe extern fn __rust_probestack() {
6464
// bytes pushed on the stack orginally with our return address. Using
6565
// `8(%rsp)` simulates us testing the stack pointer in the caller's
6666
// context.
67+
68+
// It's usually called when %rax >= 0x1000, but that's not always true.
69+
// Dynamic stack allocation, which is needed to implement unsized
70+
// rvalues, triggers stackprobe even if %rax < 0x1000.
71+
// Thus we have to check %r11 first to avoid segfault.
6772
cmp $$0x1000,%r11
6873
jna 3f
6974
2:

0 commit comments

Comments
 (0)