Fix static analysis findings in GC bridge and NativeAOT runtime#127893
Fix static analysis findings in GC bridge and NativeAOT runtime#127893
Conversation
…nk handle cleanup Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/f253b77c-d18d-4f6c-b8ed-9abbe61cfd38 Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/f253b77c-d18d-4f6c-b8ed-9abbe61cfd38 Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
|
Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib |
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/a17e077c-3c26-46f1-9178-bdd6980712d1 Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
| bool success; | ||
| success = minipal_mutex_init(&theLog.lock); | ||
| _ASSERTE(success); |
…g.h and update stresslog.cpp Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/26128bb6-29c4-4931-9bcb-12d921bc1f7a Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
…OT stressLog.cpp Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/26128bb6-29c4-4931-9bcb-12d921bc1f7a Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
| #endif | ||
|
|
||
| typedef Holder<CRITSEC_COOKIE, StressLog::Enter, StressLog::Leave, 0, CompareDefault<CRITSEC_COOKIE>> StressLogLockHolder; | ||
| typedef Holder<minipal_mutex*, StressLog::Enter, StressLog::Leave, 0, CompareDefault<minipal_mutex*>> StressLogLockHolder; |
There was a problem hiding this comment.
@copilot Delete this and replace it with minipal::MutexHolder
There was a problem hiding this comment.
Done in commit 346077a7. Deleted the StressLogLockHolder typedef and the Enter/Leave static methods. Updated Terminate and CreateThreadStressLog in stresslog.cpp to use minipal::MutexHolder directly.
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/d3a0bfa0-0985-471c-9daf-95a6dfaaf158 Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
…path Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/d3a0bfa0-0985-471c-9daf-95a6dfaaf158 Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
|
@copilot Revert last two commits. They do not look like an improvement |
… comments) Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/9fbcca80-de7f-4686-a0ea-6c342340a4f9 Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Done in commit |
Note
This PR description was generated with AI assistance.
Summary
src/coreclr/gc/gcbridge.cppby replacingfreewithdelete[]for memory allocated vianew[].CrstStaticwith inlineminipal_mutex, and asserting thatminipal_mutex_initsucceeds.src/coreclr/nativeaot/Runtime/windows/PalMinWin.cppby guardingCloseHandlecalls forhMapandhFile.CRITSEC_COOKIE lockwithminipal_mutex lockinsrc/coreclr/inc/stresslog.h(mirroring the same change already made in the NativeAOT stress log header), and updatedsrc/coreclr/utilcode/stresslog.cppto useminipal_mutex_init,minipal_mutex_enter, andminipal_mutex_leaveaccordingly.Validation
./build.sh clr+libs+host(pass)./build.sh clr+libs+host(pass)Notes
bool success; success = minipal_mutex_init(&theLog.lock); _ASSERTE(success);instead of returning on initialization failure.StressLogLockHoldertypedef instresslog.hwas updated fromHolder<CRITSEC_COOKIE, ...>toHolder<minipal_mutex*, ...>, and call sites updated to pass&theLog.lock.