Repository navigation
Conversation
…, default glibc (WIP) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179iMKNAQaUNYkq7CbbU1yT
… rest, docs (WIP) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179iMKNAQaUNYkq7CbbU1yT
…outs in the spec and feature notes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179iMKNAQaUNYkq7CbbU1yT
Three probes spelled the opaque FILE/option shells and the stat clamp through a cast; under the default they are the published layouts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179iMKNAQaUNYkq7CbbU1yT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179iMKNAQaUNYkq7CbbU1yT
…glibc default The catalog fixture is recaptured for the libctypes row. library_names' stamp round trip compiles the printed tp->tm_year against <time.h> rather than a field_0x stand-in, and the fieldtype round trip pins libctypes opaque, since it compiles beside <stdio.h> and drops the opaque shells. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179iMKNAQaUNYkq7CbbU1yT
…s and loop pointers A frame slot takes a laid-out libc record only where what else the slot holds sits on the record's members (p6 kuna_libcslot, called from RangeHint::reconcile_with): a pointer on a pointer member, a float on a float, a record on a member of its name, an integer starting on a member. A stat frame reused for an argv array no longer prints the pointers as st_ino subscripts. A libc record vote or propagation onto a constant frame address declines when the record would wrap past the top of the frame or leave the local range (kuna_libcfit::outgrows_frame); the wrapped open hint used to swallow the terminating hint and leave the slot without a symbol (&Stackffff...e8). Propagation carries a record pointer onto a pointer that steps through it only when every step meets a member of the access's width (cronie child_process), and carries the ctype table pointer only onto a value loaded as one (tar from_header's parameters and return). utsname's domainname row is laid out under its GNU spelling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179iMKNAQaUNYkq7CbbU1yT
…ad rule The table-read rule refused unsigned short ** and int ** on any value not loaded as a table pointer, which also stripped a program's own int ** (the globalpointee g_* functions printed void *a2). It now applies only to values joined to a __ctype_*_loc result through copies, casts, phis and indirect effects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179iMKNAQaUNYkq7CbbU1yT
…-slot assertions Adds LIBCTYPES #52-#55 (passes 17 and 18) on top of the merged main baseline; 6290/6290 stage assertions pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179iMKNAQaUNYkq7CbbU1yT
…r member A four-byte read of st_ino's high half (st.st_ino >> 32 at -O0) starts inside a member, so the frame-slot rule made the merge concede and the 144-byte stat collapsed to a 24-byte char array that stat() overflowed. An integer read wholly inside an integer member is a read of the record's own bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179iMKNAQaUNYkq7CbbU1yT
… its frame word At -O2 coreutils tail passes one frame word to poll as an inlined struct pollfd and to xstrtod/xstrtoumax as sleep_interval and n_units. propagate_ref gave every value in the word the pollfd piece of the typed address, and the record rode the phis into fourteen locals, one tested as a condition. A laid-out record held by value now goes, by propagation or the spacebase reference, only onto a value whose copy/phi web never reaches arithmetic, a comparison, a float operation or an address. In the restructure, a frame-slot concession on a libc misfit now holds for the rest of the merged range, so the record's own open hint no longer takes the word back. The pointer checks in kuna_libcfit::refuses also share one access walk. Stage passes 17/18 gain `pace` (fixture rebuilt, same gcc), LIBCTYPES #56/#57. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179iMKNAQaUNYkq7CbbU1yT
…, within its extent The persistent concession also fired after a pointer-vs-stat misfit that the stat won, then forced the later 152-byte sigaction hint into confusion; a confused range that is not a power of two collapses to one byte, so a sigaction and a stat sharing a frame at -O0 printed as `char buf[8]` and the round trip smashed the stack (battery t26). The flag is now set only when the merge actually left an unknown, and a later record concedes only inside that unknown's extent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179iMKNAQaUNYkq7CbbU1yT
…header Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179iMKNAQaUNYkq7CbbU1yT
…as a member A read through a pointer to a libc record the table names but does not lay out (an incomplete type: struct sockaddr, obstack, termios, ... and every record under libctypes opaque) printed as `p->field_0xN`, which compiles against neither the real headers nor kuna's own. AddTreeState no longer pretends a field sits inside such a record, so the access prints as a word at its byte offset. Stage passes 15/16/19 and a kuna-cli round trip cover a sockaddr_in read and a sockaddr_in6 read past byte 16. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179iMKNAQaUNYkq7CbbU1yT
Brings in main eb91b37. The stages baseline is re-recorded on the merged tree (6388/6388) and the phase catalog fixture is recaptured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179iMKNAQaUNYkq7CbbU1yT
SplitDatatype rooted a word copy at a `utmp *` the table names but does not lay out, so every piece was a hole and printed as `v10->field_0x2` (rsyslog wallmsg). A split no longer roots at, or backs up into, such a record. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179iMKNAQaUNYkq7CbbU1yT
This branch has not been deployed
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.
On an x86-64 glibc binary, a
struct sigaction,pollfd,addrinfoorutsnamelocal comes out split into unrelated locals, so the printed C writes a member into a variable the libc call never sees:With this change:
The change
libctypes glibclays out 17 more aggregates glibc publishes:addrinfo(whoseai_nextpoints at its own type, sop = p->ai_nextneeds no cast),hostent,servent,pollfd,fd_set,msghdr,iovec,utsname,rlimit,rusage,itimerval,utimbuf,statvfs/statvfs64,stat64, andsigactionwith itssigset_tmask.docs/features/libctypes/crosscheck.pychecks every offset and size against the installed headers (173 members in 26 records, 0 mismatches).getaddrinfo,poll,select,uname,getrlimit,getrusage,recvmsg, ...),time_t *islong *, and__ctype_b_loc/__ctype_tolower_loc/__ctype_toupper_locreturnunsigned short **/int **, soisalpha(c)reads(*v1)[c] >> 10 & 1and not*(uint2 *)(*v1 + c * 2UL).select(n, (fd_set *)&mask, ...)on a one-word mask prints the local. The ctype table type goes only to values joined to the accessor's result.sockaddr,obstack,termios,utmp, ..., and every record underopaque) is an access to an incomplete type, so it prints at its byte offset, never asp->field_0xN.ntohs(((struct sockaddr_in *)res->ai_addr)->sin_port)prints((unsigned short *)pai->ai_addr)[1](it printedpai->ai_addr->field_0x2), and thegetcrefill underopaquereads((unsigned char **)f)[1](it printed*(unsigned char **)&f->field_0x8).glibcbecomes the default. It applies only to an x86-64 ELF whose.dynstrnames glibc. A static x86-64 image keeps the old named shells, and any other target gets no slots at all: 564 repo fixtures (32-bit, ARM, MIPS, PE, Mach-O, ...) decompile byte for byte as before.--option libctypes opaquekeeps the named records without members, andoffthevoid *tables.On the decbench corpus (87,514 functions), functions with a perfect type score go 12,801 → 12,951 (+150 / −0), 803 score better and 28 worse, and casts go 463,202 → 453,421.
field_0xaccesses through libc types drop from 3,439 to 42, none of them through a record without members. With--option libctypes offevery function prints as before. Instructions executed on eight whole-binary decompiles: +0.05% in total (each binary between −0.20% and +0.22%).Tests
tests/stages/kuna-libctypes.xmlpasses 15–19 run two new fixtures. In passes 15/16 (libctypes_layouts_x86_64.c),offprints the bug incount_ai,install,readable,machine_lenandalpha_count, and the default prints the member. In passes 17/18 (libctypes_slots_x86_64.c), three functions share frame slots: a one-wordselectmask, astatframe reused forchar *s, and apollfdsharing a word with adouble. Each keeps its own object in both passes. Passes 15, 16 and 19 (opaque) read asockaddr_inand asockaddr_in6throughai_addrat byte offsets, the second 24 bytes in, past astruct sockaddr; a kuna-cli round trip compiles those two functions against the records kuna declares (and underopaqueagainst<netdb.h>) with gcc and clang at -O0 and -O2, and runs them against the source. Unit tests cover the layouts, the self-referencingaddrinfo, thesigset_tmember, the ctype rows and the slot rules. Three CLI probes and two round trips pinned the old spellings. Thelibrary_namesround trip now compiles the printedtp->tm_yearagainst<time.h>and runs it.Limitations
redirectreads its pipe descriptors as(int)buf.st_devand((int *)&buf.st_dev)[1]. In bzip2'scompressthe body is right (file_times.actime = ...; utime(..., &file_times)), butretValhas no name of its own.from_headerand dash'sreadtoken1share with other values (4 functions; no parameter or return type).iovec'siov_lenand achar *in one word, which prints asunsigned long v7; ... v1 = *v7;. The fit check looks at the record's own accesses, not at the types of its members. No corpus function shows it.char *without this change printunsigned longwith it (27 move the other way). Thechar *came from a vote by a caller decompiled later, and the new layouts change which callers have voted by then. One istest_ciphersuitein gnutls-cli at -O2, whose calls with string literals gcc 14 rejects under-Wint-conversion.field_0xN: the reserved words at the end ofstat(0x78–0x88) and the padding at 0x24 intm, read by whole-record copies. The printed definition declares those bytes as a_padarray, so these accesses do not compile against it.getrlimit64,setrlimit64,fstatvfs64orsigismember.fieldtyperound trip pinslibctypes opaque, because it compiles beside<stdio.h>.sigaction,stat).Model:
anthropic/claude-opus-5-5🤖 Generated with Claude Code
https://claude.ai/code/session_0179iMKNAQaUNYkq7CbbU1yT