Skip to content

[release/10.0] Fix TOCTOU race in AppDomain::LoadAssembly fast-path#125424

Merged
JulieLeeMSFT merged 1 commit intorelease/10.0from
backport/pr-125408-to-release/10.0
Mar 11, 2026
Merged

[release/10.0] Fix TOCTOU race in AppDomain::LoadAssembly fast-path#125424
JulieLeeMSFT merged 1 commit intorelease/10.0from
backport/pr-125408-to-release/10.0

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Mar 11, 2026

Backport of #125408 to release/10.0

/cc @AaronRobinsonMSFT

Customer Impact

  • Customer reported
  • Found internally

The reproduction rate in a real application environment is extremely low (< 1/100,000) as it requires simultaneous EOF on stdout/stderr, an unloaded target assembly, and exact OS thread preemption. This is a reliability issue tht impacted a high value enterprise customer and can impact other users.

Regression

  • Yes
  • No

Yes in PR #120515.

Testing

The change here is an obvious TOCTOU issue. The source was updated in a clearer way to avoid creating locals that are populated long before use.

Risk

Low. The source change is narrowing the use of a local behind a lock in a manner that is more local to use. This reflects better engineering practices and can easily be audited for correctness.

PR #120515 deferred Assembly creation (lazy init), making
FileLoadLock::m_pAssembly mutable. The fast-path in LoadAssembly
cached pAssembly before checking GetLoadLevel(), so a thread could
read nullptr, get preempted while another thread completed the load,
then pass the level check and dereference the stale nullptr.

Re-read pAssembly from the FileLoadLock inside the fast-path block
after the level check passes, ensuring we use the pointer that
corresponds to the observed load level.

Co-authored-by: Copilot <[email protected]>
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @agocke
See info in area-owners.md if you want to be subscribed.

@JulieLeeMSFT
Copy link
Member

/ba-g The test failure is a known issue.

@JulieLeeMSFT JulieLeeMSFT added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Mar 11, 2026
@JulieLeeMSFT JulieLeeMSFT merged commit 9ee9356 into release/10.0 Mar 11, 2026
103 of 108 checks passed
@JulieLeeMSFT JulieLeeMSFT deleted the backport/pr-125408-to-release/10.0 branch March 11, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-VM-coreclr Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants