Conversation
…ndledExceptionFilter Co-authored-by: jkotas <[email protected]>
|
@copilot Revert all changes you have made. Instead, implement the fix mentioned in #115476 (comment) |
…ExceptionFilter Co-authored-by: jkotas <[email protected]>
Reverted the previous implementation and implemented a more minimal fix that only protects the GetThreadNULLOk() call with __try/__except. The new approach stores the thread pointer once and reuses it, avoiding multiple TLS access attempts. Changes in commit 0ef7da5. |
|
@copilot Please revert all changes you have made, DO NOT use any __try/__catch, and just implement the fix that it similar to the code that I have linked to. The fix should early out from |
…Filter Co-authored-by: jkotas <[email protected]>
Reverted all previous changes and implemented the fix using NtCurrentTeb()->ThreadLocalStoragePointer null check. The function now returns early when TLS is not available, without using any __try/__except. Changes in commit 71288f5. |
Co-authored-by: jkotas <[email protected]>
There was a problem hiding this comment.
Pull request overview
Adds a defensive early-return in COMUnhandledExceptionFilter on Windows when TLS is not yet initialized, preventing a crash when the unhandled exception filter runs during very early thread startup.
Changes:
- Add a Windows-only check for
NtCurrentTeb()->ThreadLocalStoragePointer == NULLat the start ofCOMUnhandledExceptionFilterto avoid touching CLR TLS-backed state too early.
Added a null check for
NtCurrentTeb()->ThreadLocalStoragePointerat the beginning ofCOMUnhandledExceptionFilteron Windows to avoid crashing inside coreclr.dll when there is an unhandled exception early during thread initialization. We have similar check in other global EH handlers.Fixes #115476