-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot unwind stack when stack probing hits the stack limit on Unix #11495
Comments
cc: @jkotas, @echesakovMSFT, @BruceForstall |
I think the first option won't work (easily) because we currently generate the SP probe and adjustment before we save callee-saved floating-point registers (using We could add a Unix-only custom "Windows" unwind code, but I hope we don't have to do that. |
I prototyped a native helper on Linux-x64 (dotnet/coreclr@master...echesakovMSFT:JitStackProbeHelper) and both GDB and LLDB report correct backtrace.
Another advantage of using a native helper is that prolog becomes smaller and the corresponding CodeGen becomes simpler. |
Nice! It would be great to run benchmarks from the https://github.com/dotnet/performance repo with and without this change to see if it has any noticable perf impact. |
I was trying to enable dumping call stack at stack overflow on Linux and I have discovered that when stack probing in a frame hits the stack limit, the unwinder is unable to unwind from that frame. The reason is that while in the probing loop, the unwinder has no way to find the return address location.
Here is an example of a function prolog with such issue. The line that does the actual probing is marked:
It seems we have the following options here:
mov rbp, rsp
after the push rsp instead of doinglea rbp, [rsp + 0x8010]
much later. But currently, we can end up usingrbp
for the same purpose asrax
in the code above (for funclets), so that would have to be sorted out.rbp
is at an offset from the stack probing limit register (rax
in the code above). Since we have source code of the managed code unwinder in coreclr for Unix, we could afford doing that.It may be more involved for ARM / ARM64 / x86 cases, so maybe the native helper would be the best option.
category:correctness
theme:stack-allocation
skill-level:expert
cost:large
The text was updated successfully, but these errors were encountered: