Skip to content

[AUTOMATED] feat(p4): argclobber drops a trailing clobber argument only when the callee's recovered prototype says the register is free (default on) - #689

Merged
mahaloz merged 37 commits into
mainfrom
feat/argclobberproto
Sep 20, 2026
Merged

mahaloz merged 37 commits into
mainfrom
feat/argclobberproto

Conversation

@mahaloz

@mahaloz mahaloz commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

The problem

kuna calls a two-parameter callee with three arguments, and the third is a local
nothing ever assigns. The command is the arm this PR turns off by default, so it
reproduces on an unpatched tree too (output trimmed to the two functions that
carry the bug):

$ kuna decompile-all decompiler/crates/kuna-analysis/tests/fixtures/argclobber_x86_64 --option argclobber off
// Function: sub_401000 @ 0x401000
void sub_401000(unsigned long a0,long a1)
{
  long v1;
  unsigned long v2; // rdx
  unsigned long v3;

  if (a1) { // branch-flip
    sub_40102b();
    v3 = v2;
  }
  else {
    v1 = (unsigned long)(unsigned int)((int)a0 >> 0x1f) << 0x20 | a0 & 0xffffffff;
    v3 = v1 % 200 & 0xffffffff;
    a0 = v1 / 200 & 0xffffffff;
  }
  sub_401031(a0,5,v3);
}

// Function: sub_401031 @ 0x401031
long sub_401031(long a0,long a1)

v2 has no assignment anywhere in the program: rdx there is a join of the
previous call's clobber and a dead idiv remainder. coreutils fmt -O2 is the
same shape at scale. argclobber has dropped that argument since #652 but
shipped off: the only clause that could speak for the callee was a bounded
walk of its entry, and five ordinary programs hide a real read from it
(docs/features/argclobber/ce-*).

The fix

  • The admitting evidence is the callee's own recovered prototype, parked by
    protoorder ([AUTOMATED] feat(p4): decompile callees first and type call-site arguments from the callee's recovered prototype (protoorder) #669) as it decompiles the call graph callee-first. It must exist
    for that entry, have no parameter in the register, and account for every
    argument the drop leaves behind, storage for storage.
  • A prototype states what a callee names, which alone is not enough: a thunk
    recovering exactly the two parameters a drop would leave can still forward a
    third. So the callee must also have written the register wherever it can
    hand it on, and a direct call lets it through only when the target carries a
    declared non-variadic prototype or its own body answers the same question.
  • The entry walk can still only refuse a drop, never admit one.
  • default = "on", destructive = true; the row names the second effect, that
    the drop narrows the preceding call's return value where that call was the
    register's only writer.

The tests

Five tests/cli probes on four fixtures: the witness loses its phantom local,
its off arm keeps all three arguments, and three callees that would lose a live
argument keep it — ablating the forwarding clause deletes two of them again. No
stage test can carry the callee clause (park_recovered_proto is true only in
decompile_all.rs), so tests/stages/kuna-argclobber.xml pins the blanket
decline instead.

Over the 770 stripped decbench ELFs 19 functions change, each losing one trailing
argument onto the callee's true arity as checked against the unstripped twin, and
no function's JSON variables[] gains or loses an argument row. type_match over
444 slices: 1351 perfect in both arms. Worst speed delta +0.38%.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

@mahaloz mahaloz added the full-ci Run the full cargo workspace suite on this PR before merge (internal PRs skip it by default) label Sep 20, 2026
@mahaloz
mahaloz force-pushed the feat/argclobberproto branch from a9b8d7c to 4f92f75 Compare September 20, 2026 04:30
mahaloz and others added 28 commits September 20, 2026 12:08
Replaces the bounded callee-entry probe as the admitting evidence with the
prototype protoorder parks for every callee it decompiles first. The probe
stays as a veto.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
…s.toml is valid TOML

The web dev-viz snapshot parses phases.toml with tomllib, which is stricter than
the engine's own reader.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
…ument list the drop leaves

A pure forwarding thunk (`mov (%rdi),%rax; jmp *%rax`) never names the registers
it passes through, so kuna recovers one parameter for it while the function it
tail calls consumes three. The free-bytes test alone admitted a drop there and
deleted a forwarded argument.

The callee clause now also requires the recovered parameters to account, storage
for storage, for every argument that survives the drop: a recovery short of what
the call passes is not a statement that the tail is unwanted. Strictly
narrowing. ce-forward-thunk.{c,s} is the counterexample.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
… variadic

protoorder's variadic guards (Decline::UnderRecovered, RegisterFileFull) live in
the branch that parks a prototype in the symbol table; the default `types` mode
returns before them, and Decline::Variadic is only ever set from a declared `...`
so it cannot fire on a stripped image. A stripped SysV variadic is STATED. What
declines the drop there is the recovered list carrying the register, because a
register-save prologue reads every argument register the convention has.

Also: the spec's superseded 46-binary/4-function measurement replaced with the
shipped rule's 770-binary/21-function sweep, the three sibling stage tests now
say their pass-2 survival is the blanket decline rather than the clause they
describe, and the new accounting clause is written up with its counterexample.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
…arameters the call is left with

`target` read rdi and nothing else, so its recovered prototype had one parameter
while the call it is reached from passes two real arguments plus the clobber.
That is the shape the accounting clause declines, so the positive probe went red
on a rule working as intended. `target` now reads rsi as well -- the real-program
shape the coreutils fmt witness has -- and the drop fires again.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
…clause

Interleaved min-of-15: fmt +1.21%, ls +0.61%, sort -0.38%, bash -1.07%.
Worst +1.21% against a +5% budget.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
…d through an unnameable transfer

A recovered prototype states what a callee NAMES. A forwarding thunk written in
plain C names almost nothing: `long fwd(struct box *o,long a,long b) { if (!a)
return 0; return o->fn(o,a,b); }` compiles to `test %rsi,%rsi; je; jmp *(%rdi)`,
so kuna recovers two parameters for it while the function it jumps to consumes
three. Two recovered parameters are exactly the two arguments a drop leaves
behind, so the surviving-argument accounting was satisfied and the forwarded rdx
argument was deleted along with the preceding struct return's high half.

The callee-entry walk now records which of its path terminators leave for a
target it could not name -- an indirect call or tail call, a CALLOTHER, an
indexed register-file access, an undecodable instruction -- and what was written
on the way to each. A direct call is not one of them: its target has a name, so
the callee's own recovery accounted for what it passes on. argclobber requires
the register to be written before every unnameable transfer.

Adds the sixth counterexample and an in-repo fixture + tests/cli probe for it,
fixes three dangling probe filenames in the stage headers, and corrects the spec
claim that the rax:rdx-forward class was fully declined by the prototype clause.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
… carry

phases.toml row, spec 04, analysis.md and the regenerated options.md all say the
rax:rdx-forward class is declined by the prototype only where the recovery
reached far enough to name the parameter; the 2-parameter thunk is declined by
the callee's body instead. Recaptures phase_catalog.json for the reworded row.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
…d speed after the body clause

770 binaries re-swept: identical DIFF set (21), every hunk identical except
e2fsck's int8 -> void * which is #690 on the base. Arity counters on the JSON
variables[] surface across the 21 changed binaries: 23,510 functions, 0
gained/lost, 47,887 arg rows in both arms, 0 functions with a changed arg or
variable-row count. Typesweep 444 slices 1351 -> 1351, 0/0. Speed interleaved
min-of-15 worst +0.47%.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
…(argclobber)

A direct call was exempt from the forwarding check on the ground that its
target has a name. Naming it is not accounting for it: a wrapper that
forwards a register to a PLT import with no signature, or to a function
that forwards it on in turn, recovers exactly the parameters the drop
leaves behind, so the argument was deleted although the program reads it.

Each direct-call terminator now carries its target, and the forwarding
question is resolved against that target: a source declaration accounts
for what it reads, a prototype protoorder recovered has the same question
asked of it recursively, and anything else -- an unsignatured import, a
body this run never decompiled, a recursive component -- is a hole.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
… a named target does not mean

The two programs the reviewer built are committed: a wrapper that forwards
a register to an unsignatured import (no function pointer anywhere, now an
in-repo fixture and a tests/cli probe) and the pointer thunk one ordinary
call frame deeper. Ablating the direct-call arm deletes the argument in
both; with it, both render identically with the option on and off.

The claim that a direct call needs no check -- "its target has a name, so
the callee's own recovery accounted for what it passes on" -- is corrected
wherever it was stated: spec 04 in three places, the phases.toml summary
and use_when, docs/options.md, and both module headers.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz and others added 3 commits September 20, 2026 12:08
…r the forwarding clause

Worst delta +0.38% (fmt -2.91, ls -0.79, sort -0.42, bash +0.38), budget +5%.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
…mple, not bash

The bash expand_prompt rendering was the pre-forwarding-clause behaviour and no
longer happens: the import its callee reaches has to answer for rdx, so the drop
is declined. Keep the narrowing mechanism and name the program that still shows
it, matching the option's own description.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
@mahaloz
mahaloz force-pushed the feat/argclobberproto branch from f7d69d9 to f10060b Compare September 20, 2026 12:10
mahaloz and others added 3 commits September 20, 2026 12:39
…nce, and the rebased gate run

Ablating the forwarding clause on this tree deletes ce-forward-thunk-2param's
live third argument and narrows mk()'s 16-byte return with it -- both SUB168
extractions go. That is what the spec chapter and the option description now
name as the witness, in place of the bash rendering the shipped rule no longer
produces.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
…low the default flip

docs/modes.md still listed argclobber among the options a reader has to ask for
by name, which the flip makes false in both halves: it now runs under every mode,
and the list is five. Replace the bullet with what a reader actually needs -- why
it used to be excluded, what narrowed it, and that `--option argclobber off`
restores every argument the register model produced.

The same paragraph's closing enumeration claimed formatstring is not in the
preset at all; only its `full` loop is, so say that (modes.rs:119-129 already
does).

The fixture-seam comment in context.rs still explained an `off` seam above a line
that reads `true`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
…e-function arm shows

Records the gates on the tree that carries the modes.md and context.rs comment
fixes, and the one witness detail worth writing down: asking for `main` alone
(`--addr`) renders the `off` shape in both arms, because a run that decompiles no
callee parks no prototype and the drop is declined.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
@mahaloz
mahaloz force-pushed the feat/argclobberproto branch from 4d18a64 to 89849aa Compare September 20, 2026 13:51
@mahaloz
mahaloz merged commit 7243811 into main Sep 20, 2026
9 checks passed
@mahaloz
mahaloz deleted the feat/argclobberproto branch September 20, 2026 14:43
mahaloz added a commit that referenced this pull request Sep 20, 2026
…ack channels

The single worse typesweep row said "a by-value struct stat local that becomes a
byte blob". What it actually is: char v5 [80] handed to an lstat that writes 144
bytes, with st_atim/st_mtim detached into locals the body reads and nothing
writes. State that, say what causes it (the timespec * slot on
utimensat/futimens -- reverting those two slots brings stat v5 back), and record
the measurement it is kept on: over the 30 corpus slices that import either
name, 122 functions gain a timespec rendering and this is the only new
under-declared stat, against 7 that main already prints in those same slices.

Also: rebased onto argclobber (#689), stages baseline re-recorded, PR body cut
under a screen, and the statfs/export redeclaration noted beside the option's
documented export cost.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Sep 20, 2026
The 444-slice typesweep was run again in full after the rebase onto argclobber
(#689), base arm built from origin/main's kuna_libctypes.rs + protos/mod.rs in
this tree. Identical to the first run down to the per-variable tables: 1,349 ->
1,353 perfect, mean .3403 -> .3417, 147 newly correct / 6 newly wrong, 91
improved / 1 worse. Also completes the newly-correct breakdown, which was
listing 139 of the 147.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Sep 20, 2026
…stops over-claiming

`Architecture::reset_defaults_internal` set every neighbouring P5 flag but not
`char_ptr`, so the console `restore` path left `option charptr on` sticky.

The phases.toml summary and docs/spec/05-types.md both said a pointer at
anything "named or sized" is left alone. `unsigned char *` is a sized one-byte
pointee and it does move: the guard reads the type in flight, so the `char *`
vote lands before the `uint1 *` one would have propagated. Both now say so and
name the fixture that shows it.

Rebased onto origin/main (#689 argclobber); docs/baseline-stages.json
re-recorded rather than hand-merged (1249 -> 1256, seven additive charptr rows).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Sep 20, 2026
…ack channels

The single worse typesweep row said "a by-value struct stat local that becomes a
byte blob". What it actually is: char v5 [80] handed to an lstat that writes 144
bytes, with st_atim/st_mtim detached into locals the body reads and nothing
writes. State that, say what causes it (the timespec * slot on
utimensat/futimens -- reverting those two slots brings stat v5 back), and record
the measurement it is kept on: over the 30 corpus slices that import either
name, 122 functions gain a timespec rendering and this is the only new
under-declared stat, against 7 that main already prints in those same slices.

Also: rebased onto argclobber (#689), stages baseline re-recorded, PR body cut
under a screen, and the statfs/export redeclaration noted beside the option's
documented export cost.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Sep 20, 2026
The 444-slice typesweep was run again in full after the rebase onto argclobber
(#689), base arm built from origin/main's kuna_libctypes.rs + protos/mod.rs in
this tree. Identical to the first run down to the per-variable tables: 1,349 ->
1,353 perfect, mean .3403 -> .3417, 147 newly correct / 6 newly wrong, 91
improved / 1 worse. Also completes the newly-correct breakdown, which was
listing 139 of the 147.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Sep 20, 2026
…stops over-claiming

`Architecture::reset_defaults_internal` set every neighbouring P5 flag but not
`char_ptr`, so the console `restore` path left `option charptr on` sticky.

The phases.toml summary and docs/spec/05-types.md both said a pointer at
anything "named or sized" is left alone. `unsigned char *` is a sized one-byte
pointee and it does move: the guard reads the type in flight, so the `char *`
vote lands before the `uint1 *` one would have propagated. Both now say so and
name the fixture that shows it.

Rebased onto origin/main (#689 argclobber); docs/baseline-stages.json
re-recorded rather than hand-merged (1249 -> 1256, seven additive charptr rows).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Sep 20, 2026
…ack channels

The single worse typesweep row said "a by-value struct stat local that becomes a
byte blob". What it actually is: char v5 [80] handed to an lstat that writes 144
bytes, with st_atim/st_mtim detached into locals the body reads and nothing
writes. State that, say what causes it (the timespec * slot on
utimensat/futimens -- reverting those two slots brings stat v5 back), and record
the measurement it is kept on: over the 30 corpus slices that import either
name, 122 functions gain a timespec rendering and this is the only new
under-declared stat, against 7 that main already prints in those same slices.

Also: rebased onto argclobber (#689), stages baseline re-recorded, PR body cut
under a screen, and the statfs/export redeclaration noted beside the option's
documented export cost.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Sep 20, 2026
The 444-slice typesweep was run again in full after the rebase onto argclobber
(#689), base arm built from origin/main's kuna_libctypes.rs + protos/mod.rs in
this tree. Identical to the first run down to the per-variable tables: 1,349 ->
1,353 perfect, mean .3403 -> .3417, 147 newly correct / 6 newly wrong, 91
improved / 1 worse. Also completes the newly-correct breakdown, which was
listing 139 of the 147.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Sep 21, 2026
…ack channels

The single worse typesweep row said "a by-value struct stat local that becomes a
byte blob". What it actually is: char v5 [80] handed to an lstat that writes 144
bytes, with st_atim/st_mtim detached into locals the body reads and nothing
writes. State that, say what causes it (the timespec * slot on
utimensat/futimens -- reverting those two slots brings stat v5 back), and record
the measurement it is kept on: over the 30 corpus slices that import either
name, 122 functions gain a timespec rendering and this is the only new
under-declared stat, against 7 that main already prints in those same slices.

Also: rebased onto argclobber (#689), stages baseline re-recorded, PR body cut
under a screen, and the statfs/export redeclaration noted beside the option's
documented export cost.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Sep 21, 2026
The 444-slice typesweep was run again in full after the rebase onto argclobber
(#689), base arm built from origin/main's kuna_libctypes.rs + protos/mod.rs in
this tree. Identical to the first run down to the per-variable tables: 1,349 ->
1,353 perfect, mean .3403 -> .3417, 147 newly correct / 6 newly wrong, 91
improved / 1 worse. Also completes the newly-correct breakdown, which was
listing 139 of the 147.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Sep 21, 2026
…stops over-claiming

`Architecture::reset_defaults_internal` set every neighbouring P5 flag but not
`char_ptr`, so the console `restore` path left `option charptr on` sticky.

The phases.toml summary and docs/spec/05-types.md both said a pointer at
anything "named or sized" is left alone. `unsigned char *` is a sized one-byte
pointee and it does move: the guard reads the type in flight, so the `char *`
vote lands before the `uint1 *` one would have propagated. Both now say so and
name the fixture that shows it.

Rebased onto origin/main (#689 argclobber); docs/baseline-stages.json
re-recorded rather than hand-merged (1249 -> 1256, seven additive charptr rows).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Sep 21, 2026
…ack channels

The single worse typesweep row said "a by-value struct stat local that becomes a
byte blob". What it actually is: char v5 [80] handed to an lstat that writes 144
bytes, with st_atim/st_mtim detached into locals the body reads and nothing
writes. State that, say what causes it (the timespec * slot on
utimensat/futimens -- reverting those two slots brings stat v5 back), and record
the measurement it is kept on: over the 30 corpus slices that import either
name, 122 functions gain a timespec rendering and this is the only new
under-declared stat, against 7 that main already prints in those same slices.

Also: rebased onto argclobber (#689), stages baseline re-recorded, PR body cut
under a screen, and the statfs/export redeclaration noted beside the option's
documented export cost.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Sep 21, 2026
The 444-slice typesweep was run again in full after the rebase onto argclobber
(#689), base arm built from origin/main's kuna_libctypes.rs + protos/mod.rs in
this tree. Identical to the first run down to the per-variable tables: 1,349 ->
1,353 perfect, mean .3403 -> .3417, 147 newly correct / 6 newly wrong, 91
improved / 1 worse. Also completes the newly-correct breakdown, which was
listing 139 of the 147.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Sep 21, 2026
…stops over-claiming

`Architecture::reset_defaults_internal` set every neighbouring P5 flag but not
`char_ptr`, so the console `restore` path left `option charptr on` sticky.

The phases.toml summary and docs/spec/05-types.md both said a pointer at
anything "named or sized" is left alone. `unsigned char *` is a sized one-byte
pointee and it does move: the guard reads the type in flight, so the `char *`
vote lands before the `uint1 *` one would have propagated. Both now say so and
name the fixture that shows it.

Rebased onto origin/main (#689 argclobber); docs/baseline-stages.json
re-recorded rather than hand-merged (1249 -> 1256, seven additive charptr rows).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Sep 21, 2026
…ack channels

The single worse typesweep row said "a by-value struct stat local that becomes a
byte blob". What it actually is: char v5 [80] handed to an lstat that writes 144
bytes, with st_atim/st_mtim detached into locals the body reads and nothing
writes. State that, say what causes it (the timespec * slot on
utimensat/futimens -- reverting those two slots brings stat v5 back), and record
the measurement it is kept on: over the 30 corpus slices that import either
name, 122 functions gain a timespec rendering and this is the only new
under-declared stat, against 7 that main already prints in those same slices.

Also: rebased onto argclobber (#689), stages baseline re-recorded, PR body cut
under a screen, and the statfs/export redeclaration noted beside the option's
documented export cost.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Sep 21, 2026
The 444-slice typesweep was run again in full after the rebase onto argclobber
(#689), base arm built from origin/main's kuna_libctypes.rs + protos/mod.rs in
this tree. Identical to the first run down to the per-variable tables: 1,349 ->
1,353 perfect, mean .3403 -> .3417, 147 newly correct / 6 newly wrong, 91
improved / 1 worse. Also completes the newly-correct breakdown, which was
listing 139 of the 147.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Sep 21, 2026
…ack channels

The single worse typesweep row said "a by-value struct stat local that becomes a
byte blob". What it actually is: char v5 [80] handed to an lstat that writes 144
bytes, with st_atim/st_mtim detached into locals the body reads and nothing
writes. State that, say what causes it (the timespec * slot on
utimensat/futimens -- reverting those two slots brings stat v5 back), and record
the measurement it is kept on: over the 30 corpus slices that import either
name, 122 functions gain a timespec rendering and this is the only new
under-declared stat, against 7 that main already prints in those same slices.

Also: rebased onto argclobber (#689), stages baseline re-recorded, PR body cut
under a screen, and the statfs/export redeclaration noted beside the option's
documented export cost.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Sep 21, 2026
The 444-slice typesweep was run again in full after the rebase onto argclobber
(#689), base arm built from origin/main's kuna_libctypes.rs + protos/mod.rs in
this tree. Identical to the first run down to the per-variable tables: 1,349 ->
1,353 perfect, mean .3403 -> .3417, 147 newly correct / 6 newly wrong, 91
improved / 1 worse. Also completes the newly-correct breakdown, which was
listing 139 of the 147.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz added a commit that referenced this pull request Sep 21, 2026
* [AUTOMATED] wip(analysis): libctypes second round of named libc structs

Mined the libc/POSIX-named ptr_struct ground-truth pool from the DWARF twins
of the 444-slice corpus and added the slots that pay.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] wip(analysis): obstack fixture, stage passes 11-12, unit tests

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] wip: spec prose, phases.toml summary, options.md, stages baseline

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] wip: probe/test fixtures repointed, feature bundle analysis+plan

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] wip: re-capture phase_catalog fixture, move the ghidra-sim C-line pins

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] wip: feature record.json

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] wip: refresh the module header for the second round

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] docs(libcstructs): cite the twin's debug info for the nl witness

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] docs(libcstructs): record the export compile-error cost

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] docs(libcstructs): tidy the unreachable half of the ranked pool

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] docs(libcstructs): list every newly-wrong row

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] docs(libcstructs): the speed block and the gate results

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] docs(libcstructs): the quieter-moment speed confirmation

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] fix(analysis): the obstack size slots follow the channel, not the corpus

gnulib's copy of obstack.c declares its size type size_t; the installed glibc
header declares int. The table asserted size_t for both, so an image that
IMPORTS _obstack_begin/_obstack_newchunk from glibc (the five dpkg programs at
each optimization level, 15 slices of the same results tree) got a false
declaration, and the caller of a two-line glibc-obstack program went from
`void f(int n)` to `void f(unsigned int n)` with two inserted casts.

Split the channel: LIBC_DEFINED_NAMED (size_t) is seeded only from the names
the image defines and does not also import, LIBC_IMPORTED_OBSTACK (int) from
the import channel by name and by resolver address. Corrects the module and
spec prose that claimed obstack is never an import.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] docs(libcstructs): the gzip row in full, and the two obstack channels

The single worse typesweep row said "a by-value struct stat local that becomes a
byte blob". What it actually is: char v5 [80] handed to an lstat that writes 144
bytes, with st_atim/st_mtim detached into locals the body reads and nothing
writes. State that, say what causes it (the timespec * slot on
utimensat/futimens -- reverting those two slots brings stat v5 back), and record
the measurement it is kept on: over the 30 corpus slices that import either
name, 122 functions gain a timespec rendering and this is the only new
under-declared stat, against 7 that main already prints in those same slices.

Also: rebased onto argclobber (#689), stages baseline re-recorded, PR body cut
under a screen, and the statfs/export redeclaration noted beside the option's
documented export cost.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] test(stages): pin the imported obstack channel end to end

libctypes_obstack_import_x86_64 is the twin of the existing obstack fixture on
the other channel: _obstack_newchunk imported from glibc rather than linked in
from gnulib. Two assertions, off and on, pin `void grow_import(obstack *a0,int4
a1)` against #28's `uint8` -- a table that spelled both channels the same fails
one of them.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] docs(libcstructs): re-measure on the rebased base

The 444-slice typesweep was run again in full after the rebase onto argclobber
(#689), base arm built from origin/main's kuna_libctypes.rs + protos/mod.rs in
this tree. Identical to the first run down to the per-variable tables: 1,349 ->
1,353 perfect, mean .3403 -> .3417, 147 newly correct / 6 newly wrong, 91
improved / 1 worse. Also completes the newly-correct breakdown, which was
listing 139 of the 147.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] docs(libcstructs): the channel split's load cost

min-of-9 interleaved `kuna functions` over -O2 tar: 0.144s before the extra
defined-name walk, 0.142s after.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] style(analysis): shorten the inline note at the obstack seam

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] docs(libcstructs): the channel split's blast radius

decompile-all over five whole binaries, the two builds differing only by the
split: grep/tar/ls/gzip byte-identical, dpkg-query moves 7 lines.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] style(analysis): present-name set is module-private again

Nothing outside protos/mod.rs reads it now that the obstack seam takes the
defined-name set.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] docs(libcstructs): disclose the sigaction frame split

The `sigfillset(sigset_t *)` slot gives the `sa_mask` sub-object its own
identity, so a 152-byte `sigaction` frame slot splits at 136 and the
`sa_flags` store lands outside the object handed to `sigaction()`.

Measured by ablating that one table row: no `sigaction` declaration moves
anywhere in the 444 scored slices (6 of them import `sigfillset`), and in a
disjoint openssh -O2 sweep exactly one function per binary changes, all of
them `ssh_signal`. The shape already ships through `sigemptyset`, which
prints the identical split on the ablated build.

Also records the `statfs` name collision as it appears in plain
`decompile-all`, not only in a project export.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] docs(libcstructs): the sigaction repro in full

The mitigation claim is only checkable with the program it was measured on.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] docs(libcstructs): re-measure the typesweep on the new base

Third full run of both arms, this time at 69d252d. The perfect counts, the
improved/worse split and every per-variable table are unchanged; only the
pooled mean moves, 0.3403 -> 0.3405 off and 0.3417 -> 0.3419 on, which is #694
lifting both arms alike.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] docs(libcstructs): the utmp rows measured, the 32-bit size limit, the re-derived fixture swap

Adds three sections to the feature analysis: the utmp/utmpx rows reaching a
caller's own local on who/logoutd/runlevel (they ship on a pool count, not a
sweep delta, and this is what they buy); the table's sizes being glibc x86-64
with nothing scaling them by word size, and what that is confined to; and the
export fixture swap re-derived under #693's callee-first schedule.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] docs(libcstructs): record the rebase onto the callee-first export

The gate block now names the base it was run on, and a new section records how
the two repointed fixtures were re-derived under that schedule, the nine-binary
`libctypes off` identity against a build of the new base, and why the type sweep
did not need re-running (`decompile-all --json` is byte-identical between the
two bases). The timespec rows are recorded as a decision rather than a
disclosure.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] docs(libcstructs): the workspace suite result on the rebased tree

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG

* [AUTOMATED] feat(analysis): drop the sigfillset row from libctypes

It splits a struct sigaction frame slot in openssh's ssh_signal and buys
nothing in the mined pool.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL

* [AUTOMATED] feat(analysis): drop the two-element time slots and the sigset_t sub-object rows

utimensat/futimens/utimes/futimesat take a two-element array; naming one
element shrinks the caller's frame object (gzip lutimens reads a stat tail
nothing writes; scp/sftp hand utimes 16 of 32 bytes). sigsuspend,
pthread_sigmask, sigdelset, sigismember and sigwait split a struct sigaction
local when handed &sa.sa_mask.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL

* [AUTOMATED] docs(libcstructs): the spec and option row say which slots are left out and why

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL

* [AUTOMATED] docs(libcstructs): round-5 measurements, the dropped rows, off-pool notes for every kept row

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL

* [AUTOMATED] docs(libcstructs): the frame checker, the sigset_t repro and the 15-binary hunk classification

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL

* [AUTOMATED] docs(libcstructs): record.json for round 5

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL

* [AUTOMATED] test(analysis): the frame-splitting slots stay out of the libctypes tables

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL

* [AUTOMATED] chore(libcstructs): re-derive counts and generated files after rebase

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL

* [AUTOMATED] docs(libcstructs): round-5 speed block and the gates on the rebased tree

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL

* [AUTOMATED] docs(libcstructs): the gates on the #703-rebased tree

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-ci Run the full cargo workspace suite on this PR before merge (internal PRs skip it by default)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant