Skip to content

Commit

Permalink
Comments (dotnet#102325)
Browse files Browse the repository at this point in the history
* Comments

* Update src/coreclr/nativeaot/Runtime/clrgc.enabled.cpp

Co-authored-by: Jan Kotas <[email protected]>

---------

Co-authored-by: Jan Kotas <[email protected]>
  • Loading branch information
cshung and jkotas authored May 16, 2024
1 parent 189d768 commit 7c5d205
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/coreclr/nativeaot/Runtime/clrgc.enabled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ HRESULT GCHeapUtilities::InitializeStandaloneGC()
NewArrayHolder<char> moduleNameHolder(moduleName);
if (!modulePath)
{
//
// This is not a security feature.
// The libFileName originates either from an environment variable or from the runtimeconfig.json
// These are trusted locations, and therefore even if it is a relative path, there is no security risk.
//
// However, users often don't know the absolute path to their coreclr module, especially on production.
// Therefore we allow referencing it from an arbitrary location through libFilePath instead. Users, however
// are warned that they should keep the file in a secure location such that it cannot be tampered.
//
if (!ValidateModuleName(moduleName))
{
LOG((LF_GC, LL_FATALERROR, "GC initialization failed to load the Standalone GC library.\n"));
Expand Down
9 changes: 9 additions & 0 deletions src/coreclr/vm/gcheaputilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,15 @@ HMODULE LoadStandaloneGc(LPCWSTR libFileName, LPCWSTR libFilePath)
return CLRLoadLibrary(libFilePath);
}

//
// This is not a security feature.
// The libFileName originates either from an environment variable or from the runtimeconfig.json
// These are trusted locations, and therefore even if it is a relative path, there is no security risk.
//
// However, users often don't know the absolute path to their coreclr module, especially on production.
// Therefore we allow referencing it from an arbitrary location through libFilePath instead. Users, however
// are warned that they should keep the file in a secure location such that it cannot be tampered.
//
if (!ValidateModuleName(libFileName))
{
LOG((LF_GC, LL_INFO100, "Invalid GC name found %s\n", libFileName));
Expand Down

0 comments on commit 7c5d205

Please sign in to comment.