Repository navigation
[AUTOMATED] feat(analysis): libctypes glibc — real field layouts for FILE, stat, tm, passwd, group, option, dirent - #660
Merged
Merged
Conversation
Adds the `glibc` value to the libctypes option: the published x86-64 field layouts of FILE, stat, timespec, timeval, tm, passwd, group, option and dirent, installed only on an x86-64 ELF whose .dynstr names glibc. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…it tests Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…ages baseline Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…nks, record.json) Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…ms, project-export arm Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
… header, export evidence Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…ence, d_name hazard note Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
… restore_defaults Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
… catalog fixture `tests/catalog_bytecompat.rs` pins `phase catalog`'s bytes; the new `glibc` value and the row text move them. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…read the live layout Review round 2, engine half: - No layout names a member glibc reserves for itself (`stat::__pad0`, `stat::__glibc_reserved`, `_IO_FILE::__pad5`, `_IO_FILE::_unused2`). Those offsets stay holes and print in the neutral offset form. Every truthful use of such a name is a whole-struct copy spilling padding; every use that carries meaning is a lie about an enclosing struct's real member -- diffutils `diff` emitted `v15[-1].__glibc_reserved[1]` for `cmp.file[N].desc`. - `declared_libc_prototype` no longer hard-codes `Layout::Opaque`. It reads the layout off the program (`live_layout`): a held, field-filled aggregate is proof the load-time pass ran with `glibc` on an image the target gate accepted, which is the only evidence available to a `--define-function` directive that arrives after load and cannot re-run the gate. - Stage test #15 restores the file-wide `field_0x` guard #6 used to carry, by pinning the count at the four occurrences pass 4 exists to show. - Two unit tests: `no_layout_names_a_reserved_member`, `the_live_layout_is_read_off_the_program`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…claim, 16-binary evidence Review round 2, evidence half. The corpus sweep is re-run on 16 binaries -- the 8 chosen here plus 8 an adversarial review chose, disjoint from them -- and the typesweep is re-run on the build with the reserved rows dropped (identical in every figure, including the same 12 moved rows). - `glibc.md` RETRACTS "the array-index hazard occurs 14 times and every one of them is an improvement". It conflated two shapes. `p->d_name[k]` (31 sites) is always an improvement; `p[k].member` with k != 0 (10 sites) is 4 true and 6 confident mis-names, and the binary that shows it is the one the item spec named. e2fsck `init_resource_track` gives `brk_start`, `bytes_read` and `bytes_written` the names `tv_sec` and `tv_usec`, with the ground truth from the unstripped twin pasted beside it. - Two more shapes the field names get wrong are now recorded with their counterexamples: a stack slot the compiler reuses for a `stat` and an `ext2_inode`, and the `useradd` by-value loss. - `record.json` no longer presents `byvalue_named_aggregate_locals` as a safety property. It is a count, it is a net, and shadow/useradd `main` loses a recovered 144-byte `stat` stack symbol on the exact `variables[]` surface decbench scores -- scoring 0.08064516129032258 with the same tp/fp/fn in both arms, so the metric cannot see it. - The reserved-row rule and the live-layout probe are in the spec chapter, the feature doc and the hunk-classification artifact. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…mis-names A review counted dpkg-statoverride's four `v12.__pad0` / `v12.__glibc_reserved[k]` lines among the reserved rows' bad sites. They are not: `v12` IS a genuine `struct stat`, filled by the `fstat(v2,&v12)` three lines above, and the source assigns the whole struct to a global, so the compiler copies the padding with it. Those four names were right, and dropping the rows costs them -- as it costs the other fifteen truthful sites in coreutils `stat`, findutils `find` and `tar`. The trade is 19 zero-information padding names against 8 lies and one worse address form, stated as such in the feature doc and the record. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
The timings were taken before the reserved rows were dropped. That change removes four field mints per program at load and can only subtract work, so the rows stand as an upper bound; say so rather than leave the reader to assume. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…asked for Self-review of the previous commit found a real defect in it. `live_layout` read only the program, so a `--option libctypes opaque` run on an image whose own DWARF completes `stat` would have answered `Glibc` and minted a field-filled `FILE` for a `--define-function 0x..=fopen` -- the opposite of what was asked for, and on a musl image the false layout the target gate exists to prevent. Both facts now have to hold: the option value has to be `glibc`, and the program has to carry a field-filled aggregate proving the target gate passed here. The test covers the option half with the musl-with-DWARF shape that motivates it. Also: the three tests that write the `libctypes` process environment variable now take a mutex. They run as threads of one process, and the new test made an existing latent race fire -- `the_declared_lookup_follows_the_gate` read a value another test had set. Verified by running the 847-test kuna-analysis lib suite three times. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…live_layout The spec chapter, the feature doc and the record all said the probe reads the program. It reads the program AND the option value, and the option half is the one that matters: a musl image carrying its own DWARF completes `stat` and names it identically, because the kernel ABI is shared. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…residue by binary 1 in findutils find, 3 in e2fsck, 5 in diffutils diff. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…ifier excludes `p[k].field_0xNN` makes no member claim -- it is the neutral offset form and is what `opaque` prints too -- so it is not one of the 10 index-then-member sites. That is the difference between the classifier's 15 raw matches and the 10 the doc counts, and a reader re-running the script should not have to work it out. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…each, only the image is not Left over from before live_layout gained its option check: the prose said the declared path has neither the value nor the image, then said the value decides half of it. Only the image is out of reach. Also: three table rules, not two. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
A doc-comment cross-reference left behind by the reserved-row rule. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…decision, not asked The `glibc` layouts were reachable on an image the target gate refuses. A `--define-function 0x..=fopen` directive answered after the object file is out of reach, so `live_layout` re-derived the layout from the program: the option value plus one held aggregate whose offset-0 member carried the table's name. A 32-bit MIPS glibc ELF satisfies that from its own DWARF -- `st_dev` is at offset 0 of a MIPS32 `stat` too -- and minted the x86-64 216-byte `FILE`. `LibcTypesPass::run` now records its own target decision on the `AnalysisOutput` (`libctypes_glibc`); the console keeps it across the load and passes it to `declared_libc_prototype` as an explicit `layout` argument. Nothing re-derives it. The MIPS image gets `typedef struct FILE FILE; /* opaque */`; a static x86-64 glibc image (no `.dynstr`, gate refuses) does too; a dynamic x86-64 glibc image still gets the full layout for a name it never imported. The unit test that encoded the hole now asserts the refusal, and `only_a_glibc_x86_64_elf_takes_the_layouts` gains a dynamically linked MIPS32 glibc fixture (`.dynstr` names `libc.so.6` and `GLIBC_2.34`). Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…the corpus The sweep grew from 16 to 26 binaries (ten more picked by review, disjoint from both earlier groups) and three claims did not survive. - `PTRSUB(` is NOT 0 in both arms. O2/libselinux/libselinux.so.1 goes 0 -> 2, both in sub_13530, where `v50 = (int *)v14;` becomes `v50 = PTRSUB(v14,0);`. Giving FILE a member at offset 0 makes the PTRSUB matching, and the printer falls back to the functional form. Recorded with the counterexample and with the note that origin/main already emits three of them on the unstripped twin, so the shape is pre-existing engine behaviour the value now reaches on stripped images. - The slot-swallowing hazard is not only a by-value-aggregate story. Three shapes now, with the per-binary declaration delta rather than the corpus net: ssh-keygen do_gen_krl merges two `char *` and an 8-byte slot into one `char v26[24]` read through `._0_8_`/`._8_8_`/`._16_8_`. - A load spanning two fields decomposes into piece writes on a scalar local (`v1._0_4_ = a1->st_mode; v1._4_4_ = a1->st_uid;`) -- 51 sites, its own bucket, with the four binaries whose piece count moves the wrong way. All counts now come from one script, docs/features/libctypes/census.py, with per-binary rows. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
… path One declared name, `getgrnam`, against two real ELFs. Neither imports it and neither imports anything else that names a `group`, so the aggregate the declaration mints is the whole of what is under test: the x86-64 fixture takes the published 32-byte layout with `gr_name` at 0, and a new MIPS32 glibc fixture gets the fieldless shell. That fixture is built `-g` on purpose. Without debug info the old program-reading heuristic refused it too and the test would prove nothing; with it, the image's own `struct stat` and `struct timespec` put `st_dev` and `tv_sec` at offset 0, which is exactly what used to buy the x86-64 layouts. Reinstating the old heuristic fails the MIPS arm. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…sed tree Co-Authored-By: Claude Fable 5.1 <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
mahaloz
force-pushed
the
feat/libctypes-glibc
branch
from
September 17, 2026 16:49
2836be6 to
7ac0a0a
Compare
mahaloz
pushed a commit
that referenced
this pull request
Sep 17, 2026
…record the baseline main moved again (#660). #660 adds no settable, so the derived counter sites are unchanged; `counters --check` reports no drift on the rebuilt tree and docs/options.md and the bytecompat fixture are byte-fresh. Stages baseline re-recorded: 1078 -> 1081, the three hideshadow assertions and nothing else. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
mahaloz
pushed a commit
that referenced
this pull request
Sep 17, 2026
…on the libctypes-glibc base Rebased onto origin/main eb87d27 (libctypes glibc #660). The stages baseline is re-recorded rather than hand-merged: 1088 = main's 1078 + this branch's 10, with 0 assertions removed and all fifteen data:LIBCTYPES keys intact. Counters re-derived on the freshly built tree (216 settables, tiers 68/85/63, 307 corpus files) and phase_catalog.json/docs/options.md regenerated. The catalog summary and the module header now cite the full three-sweep evidence (twelve binaries, nine projects, 15,124 functions) instead of the first sweep's four binaries. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
mahaloz
added a commit
that referenced
this pull request
Sep 17, 2026
…bc merge Rebase bookkeeping only: the catalog fixture, docs/options.md and the stages baseline are re-derived on top of #660, whose rows this branch's six GH-657 assertions join. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
mahaloz
added a commit
that referenced
this pull request
Sep 17, 2026
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
mahaloz
pushed a commit
that referenced
this pull request
Sep 17, 2026
…on the libctypes-glibc base Rebased onto origin/main eb87d27 (libctypes glibc #660). The stages baseline is re-recorded rather than hand-merged: 1088 = main's 1078 + this branch's 10, with 0 assertions removed and all fifteen data:LIBCTYPES keys intact. Counters re-derived on the freshly built tree (216 settables, tiers 68/85/63, 307 corpus files) and phase_catalog.json/docs/options.md regenerated. The catalog summary and the module header now cite the full three-sweep evidence (twelve binaries, nine projects, 15,124 functions) instead of the first sweep's four binaries. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
mahaloz
pushed a commit
that referenced
this pull request
Sep 17, 2026
…on the libctypes-glibc base Rebased onto origin/main eb87d27 (libctypes glibc #660). The stages baseline is re-recorded rather than hand-merged: 1088 = main's 1078 + this branch's 10, with 0 assertions removed and all fifteen data:LIBCTYPES keys intact. Counters re-derived on the freshly built tree (216 settables, tiers 68/85/63, 307 corpus files) and phase_catalog.json/docs/options.md regenerated. The catalog summary and the module header now cite the full three-sweep evidence (twelve binaries, nine projects, 15,124 functions) instead of the first sweep's four binaries. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
mahaloz
pushed a commit
that referenced
this pull request
Sep 17, 2026
…record the baseline main moved again (#660). #660 adds no settable, so the derived counter sites are unchanged; `counters --check` reports no drift on the rebuilt tree and docs/options.md and the bytecompat fixture are byte-fresh. Stages baseline re-recorded: 1078 -> 1081, the three hideshadow assertions and nothing else. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
mahaloz
pushed a commit
that referenced
this pull request
Sep 17, 2026
…on the libctypes-glibc base Rebased onto origin/main eb87d27 (libctypes glibc #660). The stages baseline is re-recorded rather than hand-merged: 1088 = main's 1078 + this branch's 10, with 0 assertions removed and all fifteen data:LIBCTYPES keys intact. Counters re-derived on the freshly built tree (216 settables, tiers 68/85/63, 307 corpus files) and phase_catalog.json/docs/options.md regenerated. The catalog summary and the module header now cite the full three-sweep evidence (twelve binaries, nine projects, 15,124 functions) instead of the first sweep's four binaries. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
mahaloz
added a commit
that referenced
this pull request
Sep 17, 2026
…rom its operations (signedness, default auto) (#656) * [AUTOMATED] feat(p9): decide an integer local's declared signedness from its operations (signedness) New value option `signedness upstream|auto|prefer-signed|prefer-unsigned`, default `upstream` (byte-identical to not having it). P9 declaration seam, `p9_emit/kuna_typeround.rs`, consumed by `printc.rs`. Datatype::type_order ranks SUB_UINT_PLAIN (16) ahead of SUB_INT_PLAIN (17), so one uint vote outranks every int vote on a Varnode and nothing re-decides; on -O2 x86-64 those votes are structural, so a counter compiled from `int` is declared `unsigned int` and cast back at every comparison. This rounds the declaration from the operations the body applies to the value, in the spirit of TRex's type rounding (USENIX Security 2025, sections 3.3.5 and 5.1 -- re-derived from the paper and its published source, no code copied), flipping only when every signedness-sensitive reader agrees and vetoing on anything it does not model. No Varnode type, inference pass, prototype or symbol type changes. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] fix(p9): decline a local narrower than int, and stop the SEXT def-vote (signedness) Review round 1 on the signedness proposal. The neutral half of the demand table is only neutral at a fixed width, and C promotes anything narrower than `int` before any operator runs, so `prefer-unsigned` could re-declare a `short` whose `== -1` guard then folded to a constant false. A local narrower than `TypeFactory::get_size_of_int()` is no longer touched. `INT_LEFT` becomes an unsigned demand (shifting a negative value left is UB), a `CPUI_CAST` to anything but a same-width plain integer now vetoes as the docs always said it did, and `INT_SEXT`/`INT_2COMP` stop voting as definitions. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): measure flip accuracy against DWARF on 238 twins The proposal's only claimed value is fidelity, and nothing measured it. 238 unstripped DWARF twins, 6,260 declarations kuna and DWARF both name in the same function at the same width: upstream agrees 93.4% (72.0% at -O2), `auto` 93.5% (4 checkable flips, 4 right), `prefer-signed` 98.4% (94.9% at -O2; 348 right / 38 wrong), `prefer-unsigned` 92.9% and refuted by its own column. Also: counters re-derived on the rebased tree (212 settables), stages baseline re-recorded with the width-guard case, and the phase catalog fixture recaptured for the corrected summary. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): record the round-2 sweep, speed and count sites Per-value corpus sweep (auto 34 functions / 42 flips, prefer-signed 273/353, prefer-unsigned 732/889; 0 hunks of any other kind and no sub-int flip in any of them), the DWARF accuracy block, the re-run default-flip probe (675/675 and 1044/1044 PARITY OK on this tree), interleaved min-of-21 speed (+0.26%), and the count sites re-derived on the rebased tree (212 settables, tiers 68/81/63, 301 stage-corpus files). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): per-arm syntax pair + the malloc-pointer control Every one of the 1,039 changed functions compiles, before and after separately, to the identical gcc diagnostic set. The two round-trip mismatches under prefer-signed reproduce when the UNCHANGED text is compared against itself: the function returns a real malloc() pointer and the arena hash is identical in both arms. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] fix(p0): quote the signedness summary so phases.toml still parses The round-2 summary embedded a double-quoted phrase inside a double-quoted TOML value, which broke every reader that parses the file with a strict parser -- including integrations/web/build.sh, and with it the browser Worker step of the parity gates. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): the prefer-unsigned round-trip tally 86-function sample of the 732 changed under prefer-unsigned: 12 executable programs, 0 mismatches. The per-arm syntax pair already covers all 732. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] fix(p9): guard the promotion width against the reader's int, not the target's (signedness) The sub-`int` guard that keeps a narrow local from being re-signed was measured against the target cspec's `<data_organization><integer_size>`. On every kuna target where that is 2 - avr8gcc, avr8egcc, TI_MSP430, TI_MSP430X, CR16, PIC24, x86-16 - a 2-byte local was re-signed, and `if (v1 != -1)` became a constant-true test to every reader whose `int` is 4 bytes. The floor is now `max(4, get_size_of_int())`, because the promotion that matters is the one the compiler reading kuna's output performs. `tests/stages/kuna-signedness-int16.xml` pins it on x86:LE:16:Protected Mode (2/4 with the old guard, 4/4 with this one), with a 4-byte control in the same image so the decline is visibly the width rule and not an inactive option. Also drops the `INT_LEFT => Demands(Unsigned)` rule. Its stated reason was that `negative << k` is undefined in C, but signed overflow of `+ - *` is undefined on exactly the same footing and those are neutral, so the argument never separated `<<` from the rest; `INT_LEFT` also takes the default `getInputCast` arm (`care_uint_int = false`), i.e. kuna's own cast machinery does not consider the shiftee signedness-carrying. `<<` is now an ordinary carrying reader, so whatever reads the shifted value decides. In the same pass, `>> / %` record their demand *and* continue the walk, since their printed result keeps carrying the operand's declared type. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): re-measure on the shipped rule and restate the go/no-go Re-runs every measurement on the built tree after the width-guard fix, and replaces the correctness citation with an oracle that can see the diagnostics this feature moves. - the syntax pair was `gcc -fsyntax-only -w` filtered to `error:` lines, so it could not observe -Wsign-compare or -Wsign-conversion at all. Replaced by a differential WARNING oracle over the same 1,041 changed functions (385 compile in both arms): 24 sign-compare deltas, all on `==`/`!=`, 0 on an ordered comparison, with gcc's column used to tell the two apart. - the DWARF table now carries the per-optimization checkable counts (5,308 at -O0 vs 951 at -O2) and says plainly that `auto` moves 4 of them, so its fidelity is unmeasured while `prefer-signed`'s 386 flips are not. - the recommendation the data supports is stated: ship upstream|auto| prefer-signed, drop prefer-unsigned, do not default `auto` on fidelity grounds. - the `INT_LEFT` rule is documented as a preference rather than a soundness requirement, with its cost measured by building both rules (0 declarations under `auto`, 8 under `prefer-signed`, identical DWARF accuracy) -- and the claim that it caused `auto`'s six `int -> unsigned int` flips refuted: all six survive its removal and come from `>>` and unsigned compares. - round-trip coverage (8 of 34 for `auto`) moved into the PR body. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(p0): state the INT_LEFT rule as a preference in the catalog and the spec The summary and 09-emission.md described `<<` as an unsigned demand because shifting a negative value is undefined in C. That reason does not separate it from `+ - *`, so both now say what the rule actually is: a preference kept because a bit buffer is spelled unsigned in C source and because a signed `<<` is the one otherwise-neutral operator -fsanitize=undefined reports. The spec also records that `>> << / %` carry the operand's type as well as demanding, so the walk continues through them. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): round-trip coverage, speed and the gate results - executable round trip re-run on the shipped build: auto 8 of 34 link and run with 0 mismatches, prefer-signed 34 of the first 112, prefer-unsigned 28 of the first 221; the two long runs were stopped and the warning oracle covers all 1,041 changed functions either way. - speed: two interleaved min-of-21 runs pooled, +0.21% on the minimum. The median is unusable on this box -- it came out +4.56% and then -4.85% across the two runs, so the noise is larger than anything the pass can cost. - the gate results are recorded in record.json. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): re-run the default-flip probe on this tree 675/675 and 1048/1048 PARITY OK with the default flipped to `auto` and both corpora run against the unchanged baselines; the flip was reverted and the tree rebuilt, so the shipped default is still `upstream`. The round-2 probe predated the width-guard fix and the 16-bit stage test. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(p9): the demand table's lead-in still called `<<` a definedness rule Comment only; no behaviour change. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): record the post-rebase count sites and gate results Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): the workspace-suite result on the rebased tree RUST_TEST_RC=0, 7110 passed / 0 failed, and the same suite green in CI on the rebased head. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] fix(p9): round only a declaration the printer writes alone (signedness) A rounded declaration is now written only for a high that owns its own declaration line. `SignPlan::retain_sole_named` filters the printer's candidate list to sole-named entries before any collapse runs, because every collapse that follows -- the composite-Symbol retain, `collapse_symbol_decls`, `DeclDedup` and the `local_name_aliases` group suppression -- pairs two candidates that render the same name. Without it a flip on one high of such a group could move the collapse's own key, splitting a declaration that used to collapse, or re-sign the one line a non-flipped sibling's uses read through. `record_applied` already kept the cast drop honest in those cases; the declaration line itself was not guarded. Measured cost: 0 bytes over the fmt/ls/sort/du -O0+-O2 sweep (all 32 whole-binary dumps byte-identical across every value). Also corrects the `care_uint_int` citation in the module header, docs/spec/09-emission.md, analysis.md and proposal.md. The demand set is a strict SUPERSET of the ops whose `getInputCast` passes `care_uint_int = true`: `INT_SCARRY`/`INT_SBORROW`/`INT_CARRY`, a same-width `CPUI_CAST` and `INT_LEFT` all take that dispatch's default arm, which passes false. Demanding on the carry intrinsics and the cast anyway is an over-constraint, not a gap, and soundness rests on the neutral list being signedness-independent at a fixed width rather than on upstream's flag. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): the all-signed control, and what the ownership guard costs The go/no-go table was missing the control that says whether the operation walk earns its option slot: "declare every eligible plain-integer local signed, no walk at all" -- prefer-signed minus the rounding, keeping the tie-break. Measured over the same 238 DWARF twins: the control agrees 92.8% overall and 59.2% at -O2, against prefer-signed's 98.4% / 94.8% and against 71.9% for leaving the declarations alone. Of its 790 DWARF-judged flips, 376 are right and 414 wrong, and 379 of the wrong ones are `size_t` locals declared `int` where prefer-signed misdeclares 12. The unsigned demands the walk collects are what holds `size_t` unsigned. Also records the declaration-ownership guard's measured cost (8 declarations across 7 of the 238 binaries under prefer-signed, 0 under auto, 0 bytes over the fmt/ls/sort/du sweep) and re-states every table on the shipped rule: prefer-signed 7,089 -> 7,081 flips image-wide, prefer-unsigned 13,650 -> 13,636, auto unchanged. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] chore: recapture the phase_catalog fixture after the summary edit The declaration-ownership sentence added to the signedness row changed one line of the byte-compat catalog fixture. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): what the ownership guard declines, case by case Seven of the eight declarations the sole-named filter holds back are a VariableGroup whose byte pieces all render one name and read through one line (cp/ginstall/mv overwrite_ok, sort default_key_compare, find apply_predicate, tar expcmd). The eighth (shuf sparse_swap) is a conservative decline the printer would have separated by suffixing. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(p9): the care_uint_int superset had a hole and an off-by-one The demand table has eleven rows, eight of which are ops whose getInputCast passes care_uint_int = true, not seven. And the superset claim was not exact in the other direction either: FLOAT_INT2FLOAT passes care_uint_int = true whenever the operand's nonzero mask has its top bit set, and the pass does not demand on it -- it vetoes it, which is strictly stronger. Stated that way in the module header, classify_reader's doc, docs/spec/09-emission.md, analysis.md and proposal.md. Also records the round-4 speed re-measurement on the shipped build: interleaved min-of-21 whole-binary decompile-all on fmt -O2, +0.17%. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(spec): name the two ops the over-constraint sentence is about "the first three" pointed at a list of five. The carry intrinsics and the same-width cast are the over-constraints; INT_LEFT is the preference, and it is described in the paragraph above, not below. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): the gate results and count sites on the rebased tree settables 214, tiers (68, 83, 63), stage corpus 304, baseline-stages 1064. Workspace suite 7116 passed / 0 failed. ptrfromuse (#659) is default off, so every measurement in this record still holds; the repro and the sub_3060 witness were re-verified on the rebased tree regardless. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] feat(p9): make `signedness auto` the default The user's go on the proposal: land `auto` as the shipped default, keep `prefer-signed` opt-in. - phases.toml default upstream -> auto, with the summary/use_when rewritten around what the default does, why prefer-signed stays opt-in and what upstream restores. - reset_defaults sets SignPolicy::Auto; the module header, printc's field doc and docs/spec/09-emission.md say which arm ships and why. - the two stage tests name `option signedness upstream` in their upstream passes and in their prose, so each arm is read against the declaration type inference produces rather than against whichever value is the default. - docs/options.md regenerated, phase_catalog.json recaptured. make test 675/675 PARITY OK and make test-stages 1064/1064 PARITY OK with the default flipped: no assertion moved. The stages baseline is re-recorded only for three assertion NAMES that said "the default" and now name the value. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): the evidence the default flip was taken on - typesweep over the campaign's 444 slices, default (auto) against `--option signedness upstream`: all 10,748 scored functions hand the metric a byte-identical variables[], so type_match is 959 -> 959 perfect and 3037.05 -> 3037.05 aggregate, +0 everywhere. - the whole-corpus hunk classification extended from four coreutils binaries to eight across five projects (grep, gzip, tar, findutils added): 8,676 functions, 158 changed, 182 declaration flips, 224 cast-drop hunks, 246 cast tokens removed and 0 added, 0 hunks of any other kind, 0 sub-int flips. - record.json carries default_on true, the flip's gate results and both blocks; plan.md states which arm ships and why prefer-signed stays opt-in. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): the speed block and the decision, re-measured Speed on the shipped build: interleaved min-of-15 whole-binary decompile-all on fmt, ls and sort at -O2, each iteration running `--option signedness upstream` then the default back to back -- -0.05% / -2.11% / -4.49%, summed -2.94%. Two of three deltas are negative, which a pass that only adds work cannot be, so the cost is below this box's noise floor; the tightest measurement on this feature, min-of-21 on fmt at a quiet moment, was +0.17%. Inside the +5% budget either way. proposal.md answers its own question 3 and records the decision: auto by default for the casts, prefer-signed opt-in for the fidelity, prefer-unsigned kept as its control, upstream restores today's output. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): the control that says the corpora ran with the flip in A default-flip gate result means nothing if the harness builds its Architecture without reset_defaults. A scratch datatest carrying no `option signedness` line at all asserts the rounded declaration present and the cast absent, and scores 2/2 through `kuna test --datatests`; the console and CLI paths were checked the same way. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): record the gate results for the default flip Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): CI result on the final head Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] chore: re-derive the count sites and the stages baseline on the structdefs base Rebased onto origin/main 75a7f6b (structdefs #661), which moved every hard-coded counter this option also moves. Re-derived on the freshly built tree: settables 214 -> 215, tiers (68,83,63) -> (68,84,63), stage corpus 303 -> 305, catalog_bytecompat 215, the comma-terminated catalog-row count 214. docs/baseline-stages.json was re-recorded, not hand-merged: main's five data:KUNA-STRUCTDEFS assertions survive and the ten signedness assertions are the only additions (1059 + 10 = 1069). Also pins the shipped default where the suite can see it: an Architecture through reset_defaults() must report SignPolicy::Auto, and the unit test that reads SignPolicy::default() no longer claims to be reading the shipped value. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): classify the flip's hunks on a 32-bit target too The whole-corpus classification was all x86-64, where an 8-byte local is spelled `long` and a `size_t` is 8 bytes. Four ARM32 Cortex-M firmware images added (libopencm3 adc-dac-printf.elf, FreeRTOS RTOSDemo.out, ChibiOS ch.elf, crazyflie cf2.elf, -O0 and -O2): 6,448 functions, 152 changed, 194 declaration flips, 197 cast-drop hunks, 197 cast tokens removed, 0 added, 0 hunks of any other kind, 0 sub-int flips, stderr identical in both arms. 29 of those flips are the `long long -> unsigned long long` spelling a 32-bit target uses, each paired with the `(unsigned long long)` cast the flip makes a no-op -- the third printer vocabulary, which the classifier reads. Twelve binaries and nine projects now, 15,124 functions, still 0 other hunks. Also re-states the stage count (1069) and the count sites on the structdefs base. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): the gate and typesweep results on the rebased tree The 444-slice typesweep re-run in full on the structdefs base reproduces the pre-rebase report byte for byte: 10,748 functions, a byte-identical variables[] in every one of them, type_match PERFECT 959 -> 959, aggregate unchanged. Gates on the rebased tree: make test 675/675 PARITY OK, make test-stages 1069/1069 PARITY OK, make test-cli 183/183, check-spec OK lenient + strict, catalog --check OK, counters --check no drift, make rust-test RUST_TEST_RC=0 with 7,123 passing. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): the speed delta re-measured on the rebased build Interleaved min-of-15 whole-binary decompile-all on coreutils fmt and ls at -O2, upstream then the default back to back: +0.99% and -2.66%, pooled -1.79% against a +5% budget. One arm negative, as in every earlier round -- the cost is under this box's noise floor rather than a speedup. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] chore: re-derive the count sites and the stages baseline on the indirectonly base indirectonly (#663) landed on main while this branch's gates were running and moves the same hard-coded counters. Re-derived on the freshly built tree: settables 215 -> 216, tiers (68,84,63) -> (68,85,63), stage corpus 305 -> 307, catalog_bytecompat 216, the comma-terminated catalog-row count 215. docs/baseline-stages.json re-recorded rather than hand-merged: main's 1,072 assertions (structdefs' five and indirectonly's thirteen included) plus this branch's ten = 1,082, set-diffed both ways with nothing removed. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): spot-check the corpus sweep on the rebased build One ARM32 image re-decompiled on the indirectonly base: the default arm is byte-identical to the build the sweep ran on, same 26 declaration flips and 36 cast-drop hunks, 0 of any other kind. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): ship the hunk classifier with the evidence it produced The sweep table is only as good as the script that bucketed it, and that script lived in an untracked scratch dir. It now sits next to the report as classify_hunks.py, with the two decompile-all commands in its header, so any row can be re-derived -- including the third printer vocabulary (`unsigned long long`) the 32-bit rows depend on. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): the workspace-suite result on the indirectonly base RUST_TEST_RC=0, 7,132 passed / 0 failed, with the three renamed count tests and the options.md freshness test all green. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] chore: re-derive the count sites and the stages baseline on the libctypes-glibc base Rebased onto origin/main eb87d27 (libctypes glibc #660). The stages baseline is re-recorded rather than hand-merged: 1088 = main's 1078 + this branch's 10, with 0 assertions removed and all fifteen data:LIBCTYPES keys intact. Counters re-derived on the freshly built tree (216 settables, tiers 68/85/63, 307 corpus files) and phase_catalog.json/docs/options.md regenerated. The catalog summary and the module header now cite the full three-sweep evidence (twelve binaries, nine projects, 15,124 functions) instead of the first sweep's four binaries. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): the evidence re-measured on the libctypes-glibc base The stages number, the speed headline and the rebase note all name the tree they were taken on. Speed is re-measured here as an interleaved min-of-15 over fmt/ls/sort -O2 with the arm order alternating each iteration: pooled -0.56%, per binary +0.15% / -0.42% / -0.90%. Four runs now straddle zero, so the record says unmeasurable rather than reporting a speedup. The 444-slice typesweep was re-run from scratch on this base and its report is byte-identical to the shipped one, and one x86-64 and one ARM32 image were re-decompiled in both arms and match the dumps the hunk table was built from. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] chore: re-derive the count sites and the stages baseline on the foldcallret-barrier base Rebased onto origin/main 39fdc80 (GH-657 foldcallret barrier #662). The stages baseline is re-recorded, not hand-merged: 1094 = main's 1084 + this branch's 10, with 0 assertions removed and every neighbour's keys intact (15 LIBCTYPES, 13 INDIRECTONLY, 8 foldcallret, 5 STRUCTDEFS). Counters re-derived on the freshly built tree: 308 corpus files, 216 settables, tiers 68/85/63. kuna-signedness-int16.xml assertion #1 now matches the declaration by shape (`int2 v<n>;`, no pointer star) instead of by name. #662 keeps a call ahead of a write, which adds a pointer local to `f` and shifts the 2-byte value from `v1` to `v2`; the claim the assertion makes is unchanged, and it still fails 2/4 when the promotion-width guard is lowered to 2 bytes. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): the corpus sweep re-measured on the foldcallret-barrier base GH-657's fix moves the default path, so the twelve-binary hunk classification was re-taken rather than carried over: all twelve binaries re-decompiled in both arms and re-classified. The two x86-64 tables come back identical; on the ARM side cf2.elf -O0 gains one changed function and one flip, classified decl-signedness like the rest. Totals restated to 311 changed / 377 declaration flips; the bucket the claim rests on, other hunks, is 0 on every row. The 444-slice typesweep was also re-run from scratch on this base: 10,748 functions with a byte-identical variables[] in both arms, type_match 959 -> 959. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): the speed block re-measured on the foldcallret-barrier base Interleaved min-of-15 over fmt/ls/sort -O2 with the arm order alternating: +0.26% / +1.26% / -0.82%, pooled +0.20%. fmt's upstream minimum in the batch run was contended (reading -7.22%), so it was re-run alone at min-of-21 and that reading is the one carried. Six runs across four bases now straddle zero, all inside the +5% budget. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): the gate numbers and the base spot-check on the structsynth tree structsynth ships default off, so the default path is unchanged and the corpus sweep, typesweep and speed block carry over. Checked rather than assumed: grep -O2, tar -O0 and libopencm3 adc-dac-printf.elf -O2 were re-decompiled in both arms on this base and are byte-identical to the dumps those measurements were taken from. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): the workspace suite and the typesweep on the structsynth base Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] chore: re-derive the count sites and the stages baseline on the hideshadow base Rebased onto origin/main ba79503 (hideshadow #670). Counters re-derived with `counters --fix` on the freshly built tree: 218 settables, tiers 68/87/63, 312 corpus files, fixture 218 and the comma-terminated catalog-row count 217. The stages baseline is re-recorded, not hand-merged: 1113 = main's 1103 + this branch's 10, with 0 assertions removed and every neighbour's keys intact (3 hideshadow, 18 structsynth, 15 LIBCTYPES, 8 foldcallret). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): the corpus sweep re-measured on the hideshadow base hideshadow ships default-on, so the twelve-binary sweep was taken again rather than carried over: every row reproduces the shipped table exactly, stderr is identical in all 24 pairs, and the bucket the claim rests on stays at 0. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 * [AUTOMATED] docs(signedness): the typesweep and speed block on the hideshadow base The 444-slice typesweep re-run from scratch: 10,748 functions with a byte-identical variables[] in both arms, type_match 959 -> 959, and the report is byte-identical to the shipped one. Speed re-measured as an interleaved min-of-15 over fmt/ls/sort -O2: +1.12% / -0.08% / +1.08%, pooled +0.60%, taken under a load average of ~22. Seven runs across five bases now straddle zero, all inside the +5% budget. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29 --------- Co-authored-by: Claude Fable 5.1 <[email protected]> Co-authored-by: mahaloz <[email protected]>
mahaloz
added a commit
that referenced
this pull request
Sep 18, 2026
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
mahaloz
added a commit
that referenced
this pull request
Sep 18, 2026
… on d3617d6 Every reason #660 gave for keeping opaque as the default reproduces on d3617d6: copy_internal's name parameters typed stat * at -O2 -fno-inline (the 3 worse typesweep rows, now traced to an over-merged register variable), PTRSUB( 0 -> 2 on libselinux.so.1, useradd's by-value stat swallowed, ssh-keygen's swallowed slots, the index mis-names, and 51 cross-field piece writes. 444-slice typesweep: perfect 959 -> 959, aggregate +0.55, 9 improved / 3 worse -- the same 12 rows as #660. 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 19, 2026
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
libctypesnames a libc pointee but says nothing about what is inside it, so afield access on a
FILE *reads as an offset and the value it loads keepswhatever the cast said rather than the field's own type. Build the fixture this
PR adds (
decompiler/crates/kuna-analysis/tests/fixtures/libctypes_glibc_x86_64.c,gcc -O1 -o f f.c) or any program callinggetc_unlocked:That is
getc's inlined refill path reading_IO_read_ptrand_IO_read_end,and glibc publishes both offsets in a header this machine has installed.
The fix
--option libctypes glibc, installs the published x86-64members of the nine aggregates whose layout is part of the platform's API:
FILE,stat,timespec,timeval,tm,passwd,group,option,dirent. The call above readsa0->_IO_read_ptr, astatbuffer readsst->st_size, and areaddirresult's dotfile test readsd->d_name[0].st_sizeis a signed
long, so a wrapper returning-1stops printing its sentinel as0xffffffffffffffff..dynstrnames glibc. Everything else keeps the
opaqueshells, and a definition theimage's own debug info carries is still adopted whole.
stat::__pad0,stat::__glibc_reserved,_IO_FILE::__pad5,_IO_FILE::_unused2) is named: the only truthful uses ofsuch a name are padding copies, and the uses that carry meaning are lies about
an enclosing struct's real members.
--define-function 0x…=fopen) is answered after the objectfile is out of reach, so it is told the target decision the load-time pass
made rather than re-deriving one. A 32-bit MIPS glibc image gets the opaque
shell; so does a statically linked x86-64 one.
opaque. The 444-slice decbench metric is flat (perfect959 → 959, aggregate +0.55 of 3037, 9 improved / 3 worse), and
docs/features/libctypes/glibc.mdrecords the moved rows, the 26-binary sweep,the
offsetofprogram every layout was measured with, and the four shapes thevalue gets wrong — including two
PTRSUB(v14,0)in libselinux, a printerfallback
origin/mainalready reaches for a DWARF-complete struct. Speed isflat (interleaved min-of-15: +0.38% / −0.60% / −0.04%).
The tests
Two new
tests/stages/kuna-libctypes.xmlpasses over that fixture, built without-gso the table mints rather than adopts: six assertions that fail without thechange, one of them a file-wide count of the offset-named fields left anywhere.
Nine unit tests cover the tables, the mint, the nested interned
timespec, theadoption rule and the target gate. Two console tests declare the same name
(
getgrnam) against two real ELFs — an x86-64 glibc one, which takes thepublished layout, and a MIPS32 glibc one built
-g, which gets the shell.Whole-binary
decompile-allover 26 binaries, hunks classified on 16:field_0x<hex>792 → 28, piece reads 2,946 → 2,429,PTRSUB(0 → 2.🤖 Generated with Claude Code
https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29