Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

steveharter
Copy link
Member

@steveharter steveharter commented Dec 4, 2024

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.

Copy link
Contributor

@Copilot 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.

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment on lines +20 to +24
// 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);
Copy link
Member

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.

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.

Use Of Mutex should specify security descriptor
2 participants