Skip to content

Conversation

@cshung
Copy link
Contributor

@cshung cshung commented Feb 11, 2022

The function we are changing is GCHeap::NextObj, which is a public API that could be called externally.

The object could be any managed object, potentially an object coming from a frozen segment.

The code, as is, will call the object_gennum function, which will fail if an object is not in the region's range as follow:

object_gennum -> get_region_gen_num -> region_of would return an invalid heap_segment pointer.

Attempting to dereference it to get the generation number would fail.

Looking in retrospect, I have no idea why the test case wasn't failing before under regions, it should be always crashing.

@cshung cshung self-assigned this Feb 11, 2022
@ghost
Copy link

ghost commented Feb 11, 2022

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

Issue Details

null

Author: cshung
Assignees: cshung
Labels:

area-GC-coreclr

Milestone: -

@Maoni0
Copy link
Member

Maoni0 commented Feb 11, 2022

can you please put in some description of the problem, or at least a link to an issue that this is fixing?

@mangod9
Copy link
Member

mangod9 commented Feb 11, 2022

This was related to the test failures in frozen segments in a test that was recently added. Here is the failure:

@Maoni0
Copy link
Member

Maoni0 commented Feb 11, 2022

thanks. maybe it wasn't happening because you were not running a debug build? NextObj is only called on debug builds unless you specifically ask to do verification on release. the only other case is from byref validation - I dunno who asks to validate these.

Copy link
Member

@Maoni0 Maoni0 left a comment

Choose a reason for hiding this comment

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

LGTM!

@mangod9 mangod9 merged commit 8160c23 into dotnet:main Feb 11, 2022
@cshung cshung deleted the public/frozen-generation branch February 11, 2022 17:24
@ghost ghost locked as resolved and limited conversation to collaborators Mar 13, 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.

3 participants