-
Notifications
You must be signed in to change notification settings - Fork 5k
Specify a security descriptor when using global Mutex #110416
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 5 changed files in this pull request and generated 2 comments.
Files not reviewed (3)
- src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj: Language not supported
- src/libraries/System.Diagnostics.PerformanceCounter/src/System.Diagnostics.PerformanceCounter.csproj: Language not supported
- src/libraries/System.Diagnostics.PerformanceCounter/tests/System.Diagnostics.PerformanceCounter.Tests.csproj: Language not supported
src/libraries/System.Diagnostics.PerformanceCounter/tests/MutexTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/System/Diagnostics/NetFrameworkUtils.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/System/Diagnostics/NetFrameworkUtils.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.PerformanceCounter/tests/MutexTests.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj
Show resolved
Hide resolved
// We can't test with the same global mutex used by performance counters, since the mutex was likely already | ||
// initialized elsewhere and perhaps with with different ACLs, so we use a Guid to create a new mutex and | ||
// then simulate the behavior by calling into EnterMutex() like the performance monitor code does. | ||
#pragma warning disable CS0436 // Type conflicts with imported type | ||
NetFrameworkUtils.EnterMutex(mutexName, ref mutex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is just testing the utility code without invoking the product at all? Could we instead do something to ensure the product code creates the Mutex, then open the Mutex created by the product and examine the ACL? I think the test should be able to access it since it's running as the same user.
Fixes #110399
Adds the same security descriptor as .NET Framework.
This also affects EventLog; the test added here was only added to PerformanceCounter since EventLog shares the same code.
Note the S.D.PerformanceCounter and S.D.EventLog packages get a new package dependency to
System.Security.AccessControl
since that is where the extension methods are defined that are used to set the security descriptor.