Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[release/9.0-staging] Add acquire barrier to populate bit reading - #119967

#119967
Merged
AaronRobinsonMSFT merged 1 commit into
release/9.0-stagingdotnet/runtime:release/9.0-stagingfrom
backport/pr-117523-to-release/9.0-stagingdotnet/runtime:backport/pr-117523-to-release/9.0-stagingCopy head branch name to clipboard
Sep 24, 2025
Merged

[release/9.0-staging] Add acquire barrier to populate bit reading#119967
AaronRobinsonMSFT merged 1 commit into
release/9.0-stagingdotnet/runtime:release/9.0-stagingfrom
backport/pr-117523-to-release/9.0-stagingdotnet/runtime:backport/pr-117523-to-release/9.0-stagingCopy head branch name to clipboard

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 22, 2025

Copy link
Copy Markdown
Contributor

Backport of #117523 to release/9.0-staging

/cc @AaronRobinsonMSFT

Fixes #119947

Customer Impact

  • Customer reported
  • Found internally

See confirmation the fix addressed the issue in .NET 10 and the OP is requesting backport to .NET 9 - #119947. The original issue can be found at #112565.

The setting of the PInvokeMethodDesc::kPInvokePopulated bit is done via an interlocked operation. This bit is used to indicate if the PInvokeMethodDesc has been populated with the needed information to load the P/Invoke. The reading of this bit however was missing an acquire barrier and thus setting of fields between the check and set weren't being observed correctly.

Regression

  • Yes
  • No

It isn't obvious when this was likely introduced, but it is likely been in the code base for many years. It was likely uncovered by refactors of PInvoke code paths.

Testing

This was checked in .NET 10 and the external user has been running without observing a crash for several weeks.

Risk

Low. This has been running in .NET 10 preview for several weeks and an external user has been running with these bits without observing the issue.

The setting of the NDirectMethodDesc::kNDirectPopulated bit
is done via an interlocked operation. This bit is used to indicate
if the NDirectMethodDesc has been populated with the needed
information to load the P/Invoke. The reading of this bit however
was missing an acquire barrier and thus setting of fields between
the check and set weren't being observed correctly.
@AaronRobinsonMSFT AaronRobinsonMSFT added this to the 9.0.x milestone Sep 22, 2025
@AaronRobinsonMSFT AaronRobinsonMSFT added the Servicing-consider Issue for next servicing release review label Sep 22, 2025
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/interop-contrib
See info in area-owners.md if you want to be subscribed.

@rbhanda rbhanda modified the milestones: 9.0.x, 9.0.11 Sep 23, 2025
@rbhanda rbhanda added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Sep 23, 2025
@AaronRobinsonMSFT

Copy link
Copy Markdown
Member

/ba-g unrelelated timeouts

@AaronRobinsonMSFT
AaronRobinsonMSFT merged commit 979542f into release/9.0-staging Sep 24, 2025
94 of 102 checks passed
@AaronRobinsonMSFT
AaronRobinsonMSFT deleted the backport/pr-117523-to-release/9.0-staging branch September 24, 2025 17:02
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.