Skip to content

audit:contract misses invalidation masks left in C parameter indices after facade projection #1674

Closed

Description

@ehartford

Found while composing element buffers and callbacks for #1643/#1644. audit:contract reports violations=0 ok over a facade whose rendered call carries the wrong parameter invalidation mask.

Shape: C touch(const unsigned char *values, int count, Handle *owner) with buffer param values len param count renders touch(values: []u8, owner: &Owner). The owner is C parameter 2 but presented parameter 1. facade_index_call_effects passes facade_touch_params_mask(..., 0) unchanged to both signatures, so the bridge receives bit 2 (4), pointing beyond its two parameters. A record view borrowed from owner remains accepted after touch(values, owner) mutates it. This also reproduces on installed main 334739d with byte buffers; it is not specific to the new elements qualifier.

LLDB proof on the campaign stage1: Sema.facade_add_call_effect received raw sig=762, fn_sym=13358, ci=1, mask=4 from SemaFacade.w:3092; the next hit received rendered sig=767 with the same mask=4 from line 3100. The presented signature has two parameters. The audit reports contract-audit: facts=338716 violations=0 ok over the accepted stale-view program.

The parameter projection fix and stale-view regression are being included in the modeled-C buffer layer above #1672. The audit also needs to validate rendered effect indices against the Sema-owned C-to-presented parameter projection (including fixed arguments, buffer lengths, and hidden destruction callbacks), rather than only reporting the source contract inventory. This files the tool that stayed silent in the same batch, per AGENTS.md.

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