Skip to content

Commit 979542f

Browse files
Add acquire barrier to populate bit reading (#119967)
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. Co-authored-by: Aaron R Robinson <arobins@microsoft.com>
1 parent 2a20aed commit 979542f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/coreclr/vm/method.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2959,7 +2959,7 @@ class NDirectMethodDesc : public MethodDesc
29592959
BOOL IsPopulated()
29602960
{
29612961
LIMITED_METHOD_CONTRACT;
2962-
return (ndirect.m_wFlags & kNDirectPopulated) != 0;
2962+
return (VolatileLoad(&ndirect.m_wFlags) & kNDirectPopulated) != 0;
29632963
}
29642964

29652965
ULONG DefaultDllImportSearchPathsAttributeCachedValue()

0 commit comments

Comments
 (0)