Skip to content

Ownership validator accepts drop of a moved aggregate payload without reset #1170

Closed

Description

@ehartford

with analyze <repro> audit:all and check --validate-all accept an implicit-Result tail that frees its returned payload.

The reduced repro and native allocator/LLDB proof are in the companion implicit-Result ownership issue. At 5dc78b6, the audit reports facts=11510 violations=0 ok; runtime fails under the native debug allocator. MIR moves the tail join temporary into Ok, then drops the same local without the required reset/consumption bookkeeping.

Exact blind spot: validate_ownership_body in src/MirCore.w:1948 rejects MaybeGarbage and Uninit, but a Moved state is accepted on the premise that its storage was blanked. This repro's aggregate move never called consume_moved_operand, so that premise is false. mir_drop_plan_action(Moved) reports skip, while codegen still emits the drop. Checking only the ownership state does not prove physical initialization/reset at the drop.

Expected: validation must distinguish a moved-and-reset place from a moved-but-still-aliasing place, and reject a drop of the latter. It must preserve legitimate drops of reset locals, partial moves, and reassigned locals; simply rejecting every Moved drop is not an adequate fix.

Filed in the same batch as the compiler bug, per the tools-must-not-pass-silently rule. Native proof: out/with-get-investigation/result-tail-wrap-live-lldb.log; false-green output: result-branch-audit.log; invalid MIR: result-branch-mir.log.

Activity

  1. ehartford commented on Oct 25, 2026

    @ehartford
    ContributorAuthor

    Triage 2026-10-25, with v0.15.3.0 (main a261b65): does not reproduce. The runtime defect is fixed (667c6d1, #1191), and the validator side changed under it: a Drop of a place in the Moved state is elaborated to a no-op (mir_elaborate_dead_drops, src/MirCore.w:2043-2071; mir_drop_plan_action returns "skip"), and bbd2241 (#1791) added the validator's leak and double-drop rules. The companion repros below (#1175, #1177) are clean under the debug allocator.

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

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