Repository navigation
[AUTOMATED] fix(libctypes): name libc structs only where their widths hold, and not for a struct that only starts with one - #706
Merged
Conversation
mahaloz
added a commit
that referenced
this pull request
Sep 21, 2026
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
mahaloz
force-pushed
the
feat/libcstructs-followup
branch
from
September 21, 2026 21:29
9c9f62d to
80beaf2
Compare
…ine a libc aggregate vote the caller reads past Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
…er fixture, stage passes 13-14 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
…n overrun; keep the mutex rows for their arity Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
…width gate and the fit rule Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
…atalog.json recaptured Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
…two structdefs probes off i386 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
…thing (struct copies, field phis) Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
….json Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
… step by exactly one aggregate Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
…cation, ranked-pool mutex notes 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
) Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
mahaloz
force-pushed
the
feat/libcstructs-followup
branch
from
September 21, 2026 21:31
80beaf2 to
acc5bd5
Compare
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
mahaloz
marked this pull request as ready for review
September 21, 2026 22:00
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
mahaloz
added a commit
that referenced
this pull request
Sep 21, 2026
…-recorded on #706 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
mahaloz
added a commit
that referenced
this pull request
Sep 22, 2026
…-recorded on #706 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
mahaloz
added a commit
that referenced
this pull request
Sep 22, 2026
…-recorded on #706 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
mahaloz
added a commit
that referenced
this pull request
Sep 22, 2026
…-recorded on #706 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL
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
libctypesputs a libc struct where the program has a different one, in two ways.A struct whose first member is a libc aggregate gets typed as that aggregate, because both have the same address. grep's
kwsetstarts with its obstack:On a 32-bit image the struct widths, which are glibc's x86-64 ones, are too large, and the caller's frame object grows over its neighbours. i386
struct timespecis 8 bytes, soyandzbecome fields of it:The fix
void *tables, the same aslibctypes off, and so does a name declared there with--define-function.void *, and the call keeps a cast where one is needed (stat(v10,(stat *)v15)inwc, which walks&fstatus[i].st). Type propagation refuses the same type on the same evidence. This reuses the access walkprotoorderalready runs for its own votes.pthread_mutex_destroy: it scored nothing and its one argument is recovered anyway.pthread_mutex_initstays, because without it 12 calls lose theirNULLargument.After:
void kws_grow(void *a0,int a1)with*(long *)((long)a0 + 0x970) = (long)a1;, andres_sumkeepsx,y,zas its own locals.The tests
tests/stages/kuna-libctypes.xmlgains the kwset and mutex shapes, a control that keepsobstack *, and an i386 witness. Seven assertions fail without the fix. Unit tests cover the target gate, the fit rule and the name list.444-slice typesweep: 1,353 → 1,353 perfect, mean .34149 → .34145, 0 improved / 1 worse (grep
-O0kwsprep, whose obstack macro locals only ever hold a copy of the kwset pointer), exported variable counts identical. Over 663 x86-64 binaries, functions that index a named libc pointer past element 0 go from 71 to 8 (the 8 are realstruct sigactionarrays), and none of the 136 changed functions gains or loses a call. Classification:docs/features/libcstructs/followup-hunk-classification.txt.🤖 Generated with Claude Code
https://claude.ai/code/session_017ei9zqc7XHgZdMAzrk8jAL