Skip to content

gc: perry_ffi::alloc_object + later copying minor SIGSEGVs in scan_slot on a bogus slot (0x9) — documented-FFI-only repro #7164

Description

@proggeramlug

Found while validating PR #7136's GC-survival test (macOS arm64, deterministic under --test-threads=1, using only documented FFI):

perry_ffi::alloc_object() followed by a later gc_collect_minor() in the same process makes the copying collector walk a bogus slot (0x9) and SIGSEGV in gc::copying::scan_slot.

Why this matters

Repro shape

let obj = perry_ffi::alloc_object(/* … */);
// … later, same process:
gc_collect_minor();   // SIGSEGV in gc::copying::scan_slot walking slot value 0x9

Deterministic single-threaded. Observed on macOS arm64; not yet reproduced on Linux (untested, not ruled out).

Suggested first checks

  1. Does perry_ffi::alloc_object zero/initialize payload slots (or set a layout state that keeps the scanner out of uninitialized ones)? Compare against the compiled-TS allocation path's initialization.
  2. Whether layout_note_slot/SIDE_MASK state for FFI-allocated objects matches what heap_payload_slot_selection assumes (cf. fix(gc): keep live array elements traced and initialize unused array capacity #7138's stale-POINTER_FREE fix — same selection machinery).
  3. A subject-live regression test needs a pristine process — in-suite, conservative stack leftovers pin the object and mask the path (this is how fix(lru-cache): faithful JS-value keys/values, GC rooting, TTL + updateAgeOnGet #7136's test had to be structured).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions