Skip to content

Fix Linux crash loading recursive Nullable static-abstract value types#130088

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-sigsegv-linux-nullable
Draft

Fix Linux crash loading recursive Nullable static-abstract value types#130088
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-sigsegv-linux-nullable

Conversation

Copilot AI commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

This change addresses a Linux CoreCLR crash during prestub/JIT-triggered type loading of Nullable<T> when T is a recursively constrained value type using static abstract interface members. The failure came from System V struct classification assuming nested value-type metadata was always resolvable during approximate load.

  • VM change

    • Teach managed-layout System V struct classification to treat temporarily unresolved nested value-type field metadata as a conservative fallback instead of asserting.
    • Reuse small helpers to:
      • resolve value-type field handles when available
      • compute field sizes without forcing the existing assert path
    • Result: recursive/partially loaded cases fall back to non-register passing rather than crashing.
  • Regression coverage

    • Add a JIT regression covering the reported shape:
      • Nullable<UserId>
      • UserId as a readonly record struct
      • recursive generic interface constraint
      • static abstract interface members
    • Wire the test into Regression_o_2.
  • Scenario covered

    class MyNullableUser
    {
        public UserId? UserId { get; set; }
    }
    
    public interface IEntityId<TSelf> : IEntityId
        where TSelf : IEntityId<TSelf>
    {
        EntityIdValue<TSelf> Value { get; }
        static abstract int MaxValue { get; }
    }
    
    public readonly record struct UserId(EntityIdValue<UserId> Value) : IEntityId<UserId>;

Copilot AI self-assigned this Jul 1, 2026
Copilot AI review requested due to automatic review settings July 1, 2026 16:10
Copilot AI removed the request for review from Copilot July 1, 2026 16:10
Copilot AI changed the title [WIP] Fix SIGSEGV on Linux when loading Nullable<T> with readonly record struct Fix Linux crash loading recursive Nullable static-abstract value types Jul 1, 2026
Copilot AI requested a review from davidwrighton July 1, 2026 16:56
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

…th recursive generics

Co-authored-by: davidwrighton <10779849+davidwrighton@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot July 1, 2026 17:50
@davidwrighton

Copy link
Copy Markdown
Member

@copilot, returning false from HasImpliedRepeatedFields or ClassifyEightBytesWithManagedLayout is not a conservative approach, it is incorrect. We need to find a suitable TypeHandle for running the logic, not giving up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[JIT] SIGSEGV on Linux when loading Nullable<T> where T is a readonly record struct with static abstract interface members

2 participants