Skip to content

Two fuzz rounds: own keeper literal elements, own parameters given a local's value, rc arguments read through a parameter's object - #752

Merged
ASDAlexander77 merged 2 commits into
mainfrom
own-fuzz-round
Oct 30, 2026
Merged

ASDAlexander77 merged 2 commits into
mainfrom
own-fuzz-round

Conversation

@ASDAlexander77

@ASDAlexander77 ASDAlexander77 commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

A round of tslang/test/fuzz/mm_fuzz.py found 10 -mm=own failures (400 programs, seeds 70000-70399, 732 checked): 8 crashes and 2 wrong values. rc had none. They come from two causes.

Elements of a keeper's array literal were freed (9 of the 10)
A keeper is an append-only array global. Own makes everything pushed onto it immortal, so a read of one of its elements owns nothing and every release skips it. But const GA: N[] = [mk(5)] was also taken for a keeper, and the elements its literal is made with were never made immortal. So { let n = GA[0]; } freed GA[0] when the block ended.

Now an array literal makes a keeper only when every element is a constant. Elements of other literals are borrowed like any array's, and own rejects storing one into another array or a global.

A parameter given a local's value was accepted
In p = n; n = mk(9); return p.x, p = n stored n's object into a parameter's slot. That slot owns nothing, so there was no retain. Own reports "is a parameter and cannot be assigned" only while explaining a retain it could not place, so nothing was reported. Then n = mk(9) freed the object p still read.

A store of a value that owns a block into a parameter's slot is now reported in collectOwnershipOps. One exception: a value read from another parameter (iter = other, as own_for_of_borrowed_iterator.ts does) is still allowed, because the caller holds both for the whole call. Without --di the message reads "a parameter cannot be assigned under -mm=own yet", since no parameter name is known.

A second round: an argument read through a parameter's object (rc)
A second round (600 programs, seeds 71000-71599, on main with #751 and this branch) found no own failures in 1101 checked programs. It found one rc crash: g(p.n) where p was a global's object (f(HG)), and g did HG.n = mk(5). The argument was borrowed with no count, so the store freed it while g still read it, or after g gave it back.

An argument read out of a global itself was already held across such a call (#647). Now, in holdGlobalArguments, an argument read out of a field or an element of an object a parameter names is held too, whenever the callee may give any global a new value. 00call_arg_param_field_global.ts covers this under gc, rc and none; own rejects it.

Tests

  • own/own_keeper_literal_elements.ts runs under own, gc and rc, in JIT and AOT.
  • own/own_err_param_assigned_local.ts checks the new error.
  • All 10 fuzzer repros now pass, or are rejected by own.
  • Full suites with -mm=own: a read through an interface field filled by a getter is freed #751 and both commits: Windows 6449/6449, Linux (WSL) 6422/6422.
  • The default library (src/lib.ts) still compiles under own and rc.

🤖 Generated with Claude Code

ASDAlexander77 and others added 2 commits October 30, 2026 17:30
… a local's value

A round of mm_fuzz.py (400 programs, seeds 70000-70399) found 10 own
failures and no rc ones. Two causes:

- A keeper (an append-only array global) makes what is pushed onto it
  immortal, and reads of its elements own nothing. `const GA: N[] = [mk(5)]`
  was taken for one, but the elements its literal is made with were never
  made immortal, so a local given `GA[0]` freed it when its block ended
  (9 of the 10). An array literal of anything but constants makes no
  keeper now.
- `p = n` with `p` a parameter stored `n`'s value in a slot that owns
  nothing, with no retain for own to judge, so `n = mk()` then freed what
  `p` read. Own reported an assigned parameter only while explaining a
  retain; a store of a value that owns a block into a parameter's slot is
  reported now, unless the value is another parameter's, which the caller
  holds for the whole call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a call that writes a global

A second fuzz round (600 programs, seeds 71000-71599, on main with #751
and this branch) found no own failures in 1101 checked programs, and one
rc crash: `g(p.n)` where `p` was a global's object (`f(HG)`) and `g` did
`HG.n = mk(5)`. The argument was borrowed with no count, so the store freed
it while `g` still read it, or after `g` gave it back.

An argument read out of a global itself was already held across such a
call (#647). An argument read out of a field or an element of an object a
parameter names is now held too, when the callee may give any global a new
value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77 ASDAlexander77 changed the title -mm=own: two fuzzer finds - keeper literal elements, parameters given a local's value Two fuzz rounds: own keeper literal elements, own parameters given a local's value, rc arguments read through a parameter's object Oct 30, 2026
@ASDAlexander77
ASDAlexander77 merged commit 7ecc2e0 into main Oct 30, 2026
2 checks passed
@ASDAlexander77
ASDAlexander77 deleted the own-fuzz-round branch October 30, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant