Uh oh!
There was an error while loading. Please reload this page.
Properly handle debugger-enumerating interior pointers and enregistered refs - #92313
Conversation
There is an ancient bug in the dac root walking code. If we hit an interior pointer on a callstack that lives outside of the GC heap, we will report that pointer as-is to ICorDebug (specifically `CordbRefEnum::Next`). This is despite the fact that ICorDebug *specifically* requests that the dac only enumerate pointers to real objects. This non-gc pointer will be treated as a real object pointer and will cause a failed HRESULT in CordbRefEnum. Since this call is wrapped with `IfFailThrow` it will halt all further processing of roots. This code makes a small, targeted change to not enumerate non-GC pointers when the caller requests we specifically only enumerate pointers to real objects. This is not a recent regression, but rather a bug that has likely existed since the original code was written.
ghost
commented
Sep 19, 2023
Tagging subscribers to this area: @tommcdon Issue DetailsThere is an ancient bug in the dac root walking code. If we hit an interior pointer on a callstack that lives outside of the GC heap, we will report that pointer as-is to ICorDebug (specifically This code makes a small, targeted change to not enumerate non-GC pointers when the caller requests we specifically only enumerate pointers to real objects. This is not a recent regression, but rather a bug that has likely existed since the original code was written. FYI @asundheim.
|
tommcdon
commented
Sep 19, 2023
leculver
commented
Sep 20, 2023
Converting to draft while I investigate #87239 too. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
hoyosjs
commented
Sep 20, 2023
/backport to release/8.0 |
Started backporting to release/8.0: https://github.com/dotnet/runtime/actions/runs/6252309924 |
There is an ancient bug in the dac root walking code. If we hit an interior pointer on a callstack that lives outside of the GC heap, we will report that pointer as-is to ICorDebug (specifically
CordbRefEnum::Next). This is despite the fact that ICorDebug specifically requests that the dac only enumerate pointers to real objects. This non-gc pointer will be treated as a real object pointer and will cause a failed HRESULT in CordbRefEnum. Since this call is wrapped withIfFailThrowit will halt all further processing of roots, leading to not fully capturing the object graph for memory analysis.This code makes a small, targeted change to not enumerate non-GC pointers when the caller requests we specifically only enumerate pointers to real objects.
This is not a recent regression, but rather a bug that has likely existed since the original code was written.
FYI @asundheim.