Repository navigation
[AUTOMATED] feat(analysis): libctypes names 7 more libc structs - #692
Merged
Merged
Conversation
mahaloz
force-pushed
the
feat/libcstructs
branch
3 times, most recently
from
September 20, 2026 17:52
147e93f to
8bad3c1
Compare
mahaloz
force-pushed
the
feat/libcstructs
branch
3 times, most recently
from
September 21, 2026 17:09
7b9e785 to
bc2653d
Compare
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
…tests Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
…baseline Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
…is+plan Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
…m C-line pins Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
…witness Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
…d pool Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
… 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
…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
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
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
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
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
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
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
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
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
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
…e 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
…t 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
…sed tree Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
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
…igset_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
…s are left out and why Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
…, 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
…and the 15-binary hunk classification 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]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
… libctypes tables Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
…after rebase Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
…he 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]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
mahaloz
force-pushed
the
feat/libcstructs
branch
from
September 21, 2026 18:26
828b654 to
56dff57
Compare
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 struct only where the image IMPORTS the function thatdeclares it. gnulib's obstack is linked into the program instead, so the widest
aggregate in the corpus's ground truth after
FILE— 431 pointer variables — isnever named, and the declaration that would have named it is in the binary's own
symbol table. Sixty-odd other libc slots are simply missing from the table.
/usr/bin/grepon any glibc box, onmain:After:
void _obstack_newchunk(obstack *a0,unsigned long a1), with both argumentsat every call (
_obstack_newchunk(a0,v63)).Two defects of this PR were found after it merged, and #706 fixes both. It
typed grep's
kwsprep/kwsincr(sub_f210/sub_ed20) as takingobstack *,but they take
kwset_t, a struct whose first member is the obstack. And on32-bit images the x86-64 widths grow the caller's frame object over the locals
beside it.
The fix
sizeof/_Alignofand cross-checkedagainst the corpus's own DWARF:
obstack88,spwd72,utmpx384,utmp384,re_pattern_buffer64,lconv96,statfs120.more
tm/timespec/termios, the regex entry points. Signatures come fromgcc -aux-infoover the installed headers;libctypes offstaysbyte-identical to
main._obstack_*entry points are the one thing matched against a name theimage DEFINES (the reserved half of
obstack.h). Two tables, because gnulib'ssize type is
size_tand the installed glibc header saysint.utimensat/futimens/utimes/futimesat(the slot is atwo-element array, and naming one element split gzip
lutimens'sstat), andsigfillsetplus five othersigset_tslots (each splits astruct sigactionhanded
&sa.sa_mask).The tests
Six assertions on two new fixtures in
tests/stages/kuna-libctypes.xml, plus unittests over the table invariants. 444-slice typesweep: 1,349 → 1,353 perfect, mean
.3405 → .3415, 71 improved / 1 worse, exported variable counts identical. Counts
of the two renderings
mainalready prints that reach a few more calls are indocs/features/libcstructs/analysis.md.🤖 Generated with Claude Code
https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL