Skip to content

Fix race condition in AllocateManagedClassObject#81947

Merged
jkotas merged 1 commit intodotnet:mainfrom
EgorBo:fix-rc-rttype
Feb 10, 2023
Merged

Fix race condition in AllocateManagedClassObject#81947
jkotas merged 1 commit intodotnet:mainfrom
EgorBo:fix-rc-rttype

Conversation

@EgorBo
Copy link
Member

@EgorBo EgorBo commented Feb 10, 2023

This PR applies @jkotas's patch #81884 (comment)

I've verified the other places where FOH->TryAllocate is used:

  1. AllocateStaticBox - should be fine as its return value is saved via write barrier + additional volatile operations here
  2. AllocateString - should be fine, pIsFrozen is a stack local. The result of AllocateString is saved here and the AddStringLiteral itself is invoked under string-literal-lock

Hopefully, closes #81884

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@jkotas jkotas merged commit e994b20 into dotnet:main Feb 10, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Mar 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Race in RuntimeTypeCache / metadata reading

2 participants