You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Empty array allocated on the Frozen Heap for a Collectible type? #100437
if (pArrayMT->ContainsPointers() && cElements > 0)
{
// For arrays with GC pointers we can only work with empty arrays
returnNULL;
}
Where it seems that we could allow to allocate an empty array for collectible MethodTable in the Frozen heap. Shouldn't it be something like this instead?
if (pArrayMT->Collectible() || (pArrayMT->ContainsPointers() && cElements > 0))
{
// For arrays with GC pointers we can only work with empty arraysreturnNULL;
}
There is CORJIT_FLAG_FROZEN_ALLOC_ALLOWED that handles most cases, but it does not cover shared generics. The shared generic code may have CORJIT_FLAG_FROZEN_ALLOC_ALLOWED set, but the actual instantiation can be collectible. I think you should be able to reproduce the crash using a pattern like this.
Activity
dotnet-policy-service commentedon Mar 29, 2024
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
jkotas commentedon Mar 29, 2024
Yes, this looks like a bug. Could you please submit a PR with the fix?
xoofx commentedon Mar 29, 2024
Sure!
jkotas commentedon Mar 29, 2024
There is
CORJIT_FLAG_FROZEN_ALLOC_ALLOWEDthat handles most cases, but it does not cover shared generics. The shared generic code may haveCORJIT_FLAG_FROZEN_ALLOC_ALLOWEDset, but the actual instantiation can be collectible. I think you should be able to reproduce the crash using a pattern like this.xoofx commentedon Mar 29, 2024
Created PR #100444. We have tested a similar fix in our own fork, and it seems to be fixing our issues.
Fix allocation of empty array in the frozen heap for collectible types (
Fix allocation of empty array in the frozen heap for collectible types (
Fix allocation of empty array in the frozen heap for collectible types (
Fix allocation of empty array in the frozen heap for collectible types (
Fix allocation of empty array in the frozen heap for collectible types (
Fix allocation of empty array in the frozen heap for collectible types (
Fix allocation of empty array in the frozen heap for collectible types (
Fix allocation of empty array in the frozen heap for collectible types (