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

Corrupting exceptions are not turned into fail fasts #103018

Closed
jkotas opened this issue Jun 3, 2024 · 3 comments · Fixed by #103048
Closed

Corrupting exceptions are not turned into fail fasts #103018

jkotas opened this issue Jun 3, 2024 · 3 comments · Fixed by #103048
Assignees
Labels
area-ExceptionHandling-coreclr blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'
Milestone

Comments

@jkotas
Copy link
Member

jkotas commented Jun 3, 2024

Repro:

It should not be possible to catch corrupting exceptions like AccessViolationExceptions.

using System;

class Test
{
    static unsafe void Main()
    {
        try {
            *(int*)0x1235678 = 0x12345;
        }
        catch (Exception e) {
            Console.WriteLine("Here");
        }
    }
}

Actual behavior

Here

Expected behavior

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at Test.Main()

Known Issue Error Message

Fill the error message using step by step known issues guidance.

{
  "ErrorMessage": "",
  "ErrorPattern": "",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Report

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 0 0
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Jun 3, 2024
@jkotas jkotas added this to the 9.0.0 milestone Jun 3, 2024
@jkotas
Copy link
Member Author

jkotas commented Jun 3, 2024

cc @janvorli @VSadov

@jkotas
Copy link
Member Author

jkotas commented Jun 4, 2024

This blocks post-mortem debugging of CI crashes caused by access violations (e.g. see #102919).

@jkotas jkotas added the blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' label Jun 4, 2024
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Jun 4, 2024
@janvorli
Copy link
Member

janvorli commented Jun 4, 2024

I've found the culprit, missing handling of access violation as a failfast in the GetClasslibException. I'll fix it.

@janvorli janvorli self-assigned this Jun 4, 2024
janvorli added a commit to janvorli/runtime that referenced this issue Jun 4, 2024
The new EH is not correctly handling corrupting state exceptions.
Instead of failing fast, the exceptions are actually handled like other
exceptions and can be caught by the user code.

This change fixes it. Besides fixing the issue, I had to introduce a way
to trim exception handling code frames from the stack trace reported by
the failfast, otherwise the output would be confusing.

As an additional change, I've noticed that hardware exceptions under
WinDbg don't trigger the WinDbg first chance exception mechanism. I've
recently fixed the same for software exceptions, this adds the same for
hardware ones.

Close dotnet#103018
janvorli added a commit that referenced this issue Jun 5, 2024
* Fix handling of corrupting state exceptions

The new EH is not correctly handling corrupting state exceptions.
Instead of failing fast, the exceptions are actually handled like other
exceptions and can be caught by the user code.

This change fixes it. Besides fixing the issue, I had to introduce a way
to trim exception handling code frames from the stack trace reported by
the failfast, otherwise the output would be confusing.

As an additional change, I've noticed that hardware exceptions under
WinDbg don't trigger the WinDbg first chance exception mechanism. I've
recently fixed the same for software exceptions, this adds the same for
hardware ones.

Close #103018

* Remove the WinDbg first chance notification
@github-actions github-actions bot locked and limited conversation to collaborators Jul 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-ExceptionHandling-coreclr blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants