Skip to content
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

Report StackOverflowException on NativeAOT on Linux #93901

Closed
wants to merge 118 commits into from

Conversation

jtschuster
Copy link
Member

@jtschuster jtschuster commented Oct 24, 2023

Uses almost the same code as CoreCLR to allocate an alternate stack for handling SIGSEGV, and properly reports a StackOverflowException.

Fixes #82334

Use SA_ONSTACK for SIGSEGV handler
Call sigaltstack() to set the alternate stack on the main thread only
Check if faulting address is near the stack pointer, if so, report stack overflow
@ghost
Copy link

ghost commented Oct 24, 2023

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details

Uses almost the same code as CoreCLR to allocate an alternate stack for handling SIGSEGV, and properly reports a StackOverflowException.

Author: jtschuster
Assignees: jtschuster
Labels:

area-NativeAOT-coreclr

Milestone: -

@jkotas jkotas requested a review from janvorli October 24, 2023 02:39
Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

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

LGTM modulo the nit comment

src/coreclr/nativeaot/Runtime/thread.cpp Outdated Show resolved Hide resolved
@janvorli
Copy link
Member

One thing I wonder about - don't we also want to call PalRaiseFailFastException instead of RhFailFast (like we do on Windows for stack overflow in RhpVectoredExceptionHandler)?

@jkotas
Copy link
Member

jkotas commented Oct 24, 2023

One thing I wonder about - don't we also want to call PalRaiseFailFastException instead of RhFailFast (like we do on Windows for stack overflow in RhpVectoredExceptionHandler)?

RhFailFast calls PalRaiseFailFastException with default arguments. I do not think calling PalRaiseFailFastException in this change would make any difference.

@janvorli
Copy link
Member

Ah, thank you, I've missed that.

@jtschuster
Copy link
Member Author

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jtschuster
Copy link
Member Author

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@janvorli
Copy link
Member

@jtschuster I am not sure if merging of the tests into a single exe won't complicate the work on merging coreclr tests that @trylek works on. I wonder what the reason for this change was.

pavelsavara and others added 11 commits November 7, 2023 11:32
Rationalization removes all GT_NOP nodes, and we do not seem to
introduce any of these before LSRA (and especially not the typed
"passthrough" GT_NOP nodes). This code is just wrong for the passthrough
nodes, so just switch all the LSRA code to only handle potential void
NOPs.

Fix dotnet#93048
Microsoft.Dotnet.Sdk.Internal
 From Version 9.0.100-alpha.1.23554.1 -> To Version 9.0.100-alpha.1.23557.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
* Add file handle limit setting for Alpine

Alpine does not automatically increase the file handle limit to the maximum. dotnet#82719 (comment)
As a result we need to increase the limit manually, as we are seeing "Too many files" errors.

* Bump limit to hard cap

* Remove space
Maybe I'm missing something, but if we try to commit more of the reserved segment and this fails, it doesn't feel right to release the whole thing. The previously committed part of the segment is still in use.
* Use live M.Bcl.AsyncInterfaces dependency

* Update Microsoft.Bcl.TimeProvider.csproj
…nals build 20231106.2 (dotnet#94463)

Microsoft.SourceBuild.Intermediate.source-build-externals
 From Version 9.0.0-alpha.1.23530.1 -> To Version 9.0.0-alpha.1.23556.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
@jtschuster
Copy link
Member Author

I made some mistake when I pulled main back into this branch. Closing this PR and opened a new one.

@jtschuster jtschuster closed this Nov 7, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 8, 2023
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.

[NativeAOT] Stackoverflow reporting on Linux