Skip to content

nested FailFast#121306

Merged
pavelsavara merged 8 commits intodotnet:mainfrom
pavelsavara:fail_fast
Nov 4, 2025
Merged

nested FailFast#121306
pavelsavara merged 8 commits intodotnet:mainfrom
pavelsavara:fail_fast

Conversation

@pavelsavara
Copy link
Member

@pavelsavara pavelsavara commented Nov 3, 2025

  • make sure that in nested call to FailFast we don't call managed code (which likely causes the recursive FailFast).

Contributes to #121107

@pavelsavara pavelsavara added this to the 11.0.0 milestone Nov 3, 2025
@pavelsavara pavelsavara self-assigned this Nov 3, 2025
@dotnet-policy-service
Copy link
Contributor

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a potential reentrancy issue during Environment.FailFast execution and adds GC protection for a STRINGREF that could be moved during garbage collection.

  • Adds GC protection around pString->GetSString(result) to prevent the STRINGREF from being moved during potential GC triggers
  • Implements a reentrancy guard using alreadyfailing counter to prevent recursive exception message retrieval during FailFast handling

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/coreclr/vm/excep.cpp Adds GCPROTECT_BEGIN/END around GetSString call to protect STRINGREF from being moved during GC
src/coreclr/classlibnative/bcltype/system.cpp Adds reentrancy counter to prevent calling GetExceptionMessage during nested FailFast calls

pavelsavara and others added 2 commits November 4, 2025 14:39
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@pavelsavara
Copy link
Member Author

/ba-g CI timeout - android helix

@pavelsavara pavelsavara merged commit 9e1a746 into dotnet:main Nov 4, 2025
94 of 96 checks passed
@pavelsavara pavelsavara deleted the fail_fast branch November 4, 2025 17:09
@github-actions github-actions bot locked and limited conversation to collaborators Dec 5, 2025
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.

2 participants