Skip to content

Fix gc hole in Frozen.cs - #76868

Merged
EgorBo merged 3 commits into
dotnet:mainfrom
EgorBo:fix-gc-hole-frozen
Oct 11, 2022
Merged

Fix gc hole in Frozen.cs#76868
EgorBo merged 3 commits into
dotnet:mainfrom
EgorBo:fix-gc-hole-frozen

Conversation

@EgorBo

@EgorBo EgorBo commented Oct 11, 2022

Copy link
Copy Markdown
Member

Fixes #76856

Confirmed that the test stopped crashing after this change.

@ghost ghost added the area-GC-coreclr label Oct 11, 2022
@ghost ghost assigned EgorBo Oct 11, 2022
@ghost

ghost commented Oct 11, 2022

Copy link
Copy Markdown

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

Issue Details

Closes #76856

Author: EgorBo
Assignees: -
Labels:

area-GC-coreclr

Milestone: -

@EgorBo EgorBo left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@EgorBo
EgorBo force-pushed the fix-gc-hole-frozen branch from 6cf8a07 to d6f1257 Compare October 11, 2022 11:32
Comment thread src/tests/GC/API/Frozen/Frozen.cs Outdated
Comment thread src/tests/GC/API/Frozen/Frozen.cs Outdated
ref Unsafe.As<RawData>(obj).Data;

internal static unsafe IntPtr GetMethodTablePointer(object obj) =>
(IntPtr)Unsafe.Add(ref Unsafe.As<byte, IntPtr>(ref obj.GetRawData()), -1);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This assumes that offset 0 is a valid byref. It happens to be true in CoreCLR today, but it is not a safe assumption to make.

EgorBo and others added 2 commits October 11, 2022 17:51
Co-authored-by: Jan Kotas <jkotas@microsoft.com>

@cshung cshung left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the fix

@EgorBo
EgorBo merged commit af63f60 into dotnet:main Oct 11, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Nov 11, 2022
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.

Test failure: GC\\API\\Frozen\\Frozen\\Frozen.cmd

3 participants