Skip to content

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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants