Skip to content

Conversation

@janvorli
Copy link
Member

When SuperPMI shared library is loaded last, its SIGSEGV handler is the first one that's executed. But since there is no coreclr runtime handler installed for it, it returns from the SwitchStackAndExecuteHandler in case of SIGSEGV. The remaining code in the SIGSEGV handler was not expecting that and thought that there was no stack overflow and attempted to run the hardware exception handler on the original stack of the thread, which obviously crashed since the original stack overflowed.
The fix is to make sure that we only call the previously registered signal handler in this case.

Close #84911

When SuperPMI shared library is loaded last, its SIGSEGV handler
is the first one that's executed. But since there is no coreclr runtime handler
installed for it, it returns from the SwitchStackAndExecuteHandler in case
of SIGSEGV. The remaining code in the SIGSEGV handler was not expecting that and
thought that there was no stack overflow and attempted to run the hardware exception
handler on the original stack of the thread, which obviously crashed since the original
stack overflowed.
The fix is to make sure that we only call the previously registered signal handler in
this case.

Close dotnet#84911
@janvorli janvorli added this to the 10.0.0 milestone Aug 15, 2024
@janvorli janvorli requested a review from jkotas August 15, 2024 19:35
@janvorli janvorli self-assigned this Aug 15, 2024
// hardware signal handler on the original stack.

if (GetCurrentPalThread() && IsRunningOnAlternateStack(context))
if (!isStackOverflow)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!isStackOverflow)
else

?

@janvorli
Copy link
Member Author

/azp run runtime-coreclr superpmi-collect

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@janvorli janvorli merged commit 9230f2b into dotnet:main Aug 16, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test failure baseservices\\exceptions\\stackoverflow\\stackoverflowtester\\stackoverflowtester.cmd

2 participants