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

Merged
merged 3 commits into from
May 15, 2025

Conversation

steveharter
Copy link
Contributor

@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

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.

@ericstj
Copy link
Member

ericstj commented May 14, 2025

/azp run runtime

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ericstj ericstj merged commit 81f1f5e into dotnet:main May 15, 2025
85 of 90 checks passed
akoeplinger added a commit to dotnet/aspnetcore that referenced this pull request May 22, 2025
wtgodbe pushed a commit to dotnet/aspnetcore that referenced this pull request May 22, 2025
* [VMR] Codeflow e26a16c-e26a16c

[[ commit created by automation ]]

* Update dependencies from https://github.com/dotnet/dotnet build 268973
No dependency updates to commit

* Align M.CA package versions

* Update dependencies from https://github.com/dotnet/dotnet build 269082
Updated Dependencies:
dotnet-ef, Microsoft.EntityFrameworkCore.InMemory, Microsoft.EntityFrameworkCore.Relational, Microsoft.EntityFrameworkCore.Sqlite, Microsoft.EntityFrameworkCore.SqlServer, Microsoft.EntityFrameworkCore.Tools, Microsoft.EntityFrameworkCore, Microsoft.EntityFrameworkCore.Design (Version 10.0.0-preview.4.25269.109 -> 10.0.0-preview.4.25265.101)
Microsoft.Extensions.Caching.Abstractions, Microsoft.Extensions.Caching.Memory, Microsoft.Extensions.Configuration.Abstractions, Microsoft.Extensions.Configuration.Binder, Microsoft.Extensions.Configuration.CommandLine, Microsoft.Extensions.Configuration.EnvironmentVariables, Microsoft.Extensions.Configuration.FileExtensions, Microsoft.Extensions.Configuration.Ini, Microsoft.Extensions.Configuration.Json, Microsoft.Extensions.Configuration.UserSecrets, Microsoft.Extensions.Configuration.Xml, Microsoft.Extensions.Configuration, Microsoft.Extensions.DependencyInjection.Abstractions, Microsoft.Extensions.DependencyInjection, Microsoft.Extensions.Diagnostics, Microsoft.Extensions.Diagnostics.Abstractions, Microsoft.Extensions.FileProviders.Abstractions, Microsoft.Extensions.FileProviders.Composite, Microsoft.Extensions.FileProviders.Physical, Microsoft.Extensions.FileSystemGlobbing, Microsoft.Extensions.HostFactoryResolver.Sources, Microsoft.Extensions.Hosting.Abstractions, Microsoft.Extensions.Hosting, Microsoft.Extensions.Http, Microsoft.Extensions.Logging.Abstractions, Microsoft.Extensions.Logging.Configuration, Microsoft.Extensions.Logging.Console, Microsoft.Extensions.Logging.Debug, Microsoft.Extensions.Logging.EventSource, Microsoft.Extensions.Logging.EventLog, Microsoft.Extensions.Logging.TraceSource, Microsoft.Extensions.Logging, Microsoft.Extensions.Options.ConfigurationExtensions, Microsoft.Extensions.Options.DataAnnotations, Microsoft.Extensions.Options, Microsoft.Extensions.Primitives, Microsoft.Internal.Runtime.AspNetCore.Transport, System.Configuration.ConfigurationManager, System.Diagnostics.DiagnosticSource, System.Diagnostics.EventLog, System.DirectoryServices.Protocols, System.Formats.Asn1, System.IO.Pipelines, System.Net.Http.Json, System.Net.Http.WinHttpHandler, System.Net.ServerSentEvents, System.Reflection.Metadata, System.Resources.Extensions, System.Security.Cryptography.Pkcs, System.Security.Cryptography.Xml, System.Security.Permissions, System.ServiceProcess.ServiceController, System.Text.Encodings.Web, System.Text.Json, System.Threading.AccessControl, System.Threading.Channels, System.Threading.RateLimiting, Microsoft.Extensions.DependencyModel, Microsoft.NETCore.App.Ref, Microsoft.NET.Runtime.MonoAOTCompiler.Task, Microsoft.NET.Runtime.WebAssembly.Sdk, Microsoft.Bcl.AsyncInterfaces, Microsoft.Bcl.TimeProvider, System.Collections.Immutable, System.Diagnostics.PerformanceCounter, System.IO.Hashing, System.Memory.Data, System.Numerics.Tensors, System.Runtime.Caching, Microsoft.NETCore.App.Runtime.win-x64, Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm, Microsoft.NETCore.BrowserDebugHost.Transport, System.Composition, Microsoft.NETCore.Platforms (Version 10.0.0-preview.5.25269.109 -> 10.0.0-preview.5.25265.101)
Microsoft.Web.Xdt (Version 10.0.0-preview.25269.109 -> 10.0.0-preview.25265.101)
Microsoft.DotNet.HotReload.Agent, Microsoft.DotNet.HotReload.Agent.Data (Version 10.0.100-preview.5.25269.109 -> 10.0.100-preview.5.25265.101)
Microsoft.DotNet.Arcade.Sdk, Microsoft.DotNet.Build.Tasks.Archives, Microsoft.DotNet.Build.Tasks.Installers, Microsoft.DotNet.Build.Tasks.Templating, Microsoft.DotNet.Helix.Sdk, Microsoft.DotNet.RemoteExecutor, Microsoft.DotNet.SharedFramework.Sdk (Version 10.0.0-beta.25269.109 -> 10.0.0-beta.25265.101)

* Add System.Threading.AccessControl to expected assemblies

It was added in dotnet/runtime#110416

* Adjust expected exit code in ShutdownTests.cs

This is a behavior change introduced by dotnet/runtime#115494

* Fix method name, kill by default sends TERM not INT

* Revert "Adjust expected exit code in ShutdownTests.cs"

This reverts commit 3c695d2.

* React to dotnet/runtime#115494

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Matt Thalman <[email protected]>
Co-authored-by: Alexander Köplinger <[email protected]>
Co-authored-by: Jan Kotas <[email protected]>
akoeplinger added a commit to dotnet/aspnetcore that referenced this pull request May 23, 2025
dotnet-maestro bot added a commit to dotnet/aspnetcore that referenced this pull request May 23, 2025
[release/10.0-preview5] Source code updates from dotnet/dotnet


 - Align M.CA package versions

(cherry picked from commit ce921d3)

 - Add System.Threading.AccessControl to expected assemblies

It was added in dotnet/runtime#110416

(cherry picked from commit 1d3d3de)

 - React to dotnet/runtime#115494

(cherry picked from commit 97ebf48)
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