Repository navigation
[AUTOMATED] xrefs: an address formed from the PC is a reference below 0x1000 - #1371
Conversation
… 0x1000 A zero-based image (an arm64 Mach-O dylib, an ELF shared object or PIE whose first page ld.lld fills with .rodata, firmware linked at 0) keeps real addresses under the checkOperands 4096 floor, and the floor dropped every address the program formed there: `adrp x0,0x0; add x0,x0,#0x2d0` naming a dylib's first function, `lea rdi,[rip+...]` into first-page .rodata, an auipc pair, A32/Thumb adr. The floor separates numbers from addresses among immediates, so a value computed from the instruction's own address is now exempt and only has to land in a mapped section. listing/kuna_pcform.rs recognises the forms SLEIGH folds into plain constants (AArch64 adr/adrp, x86-64 RIP-relative lea, A32/Thumb adr) from the encoding and recomputes their value from the bytes; only a constant equal to it is exempt. regcarry tracks PC-relativity through add/sub of a non-PC value (auipc's visible inst_start included), never through a difference of two, a mask or a shift; picbase exempts values composed through the proven base. Built only for images that map something below the floor. Read-only xref query: no option. Over 375 images no row is lost; 700 rows are added, each verified as a PC-relative formation (capstone, GNU objdump, by hand). Fixes #1364 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWRVoTEYHNosYwYRoSE
A PC-relative value kept its exemption from the checkOperands floor through any low-part read, so `lea rax,[rip+tB]; movzx ecx,al; lea rdx,[rcx+0x300]` (and Thumb `adr; uxtb; adds`) filed (tB & 0xff) + 0x300 as a data reference in a zero-based image. The exemption now survives a truncation only to 32 bits or wider (`lea eax,[rip+..]`, `sext.w`), the narrowest a pointer gets. The 382-image low-page sweep is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWRVoTEYHNosYwYRoSE
Resolve the overlap with #1366 (fall-through addresses) by keeping both behaviours: data_refs takes both the PC-formed values and the delay-slot probe; regcarry files a fall-through value unless the instruction calls, and admits a PC-relative value below the floor; picbase admits a fall-through unless the instruction links, with the PC flag of what it composed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWRVoTEYHNosYwYRoSE
…d get two readers (#1303) One function of Ubuntu 26.04's bash (5.3-2ubuntu1, `sub_e87b0`) came out empty: three IMULs share the 16-byte flag temporary `u0x5a200`, heritage carries it across blocks, and splitting its lanes would give a free varnode four readers. `TransformManager::apply` now runs `check_free_fanout` before rewriting anything: temporaries and non-input lanes are checked, constants are exempt (each later reader of a constant gets its own copy). `ActionLaneDivide` counts a refusal as a failed trace, so it tries the next lane size and the function decompiles instead of failing; an error after rewriting has started still fails the function. `RuleSplitFlow` and `RuleSubfloatConvert` no longer leave a half-rewritten function for this error. Output is otherwise byte-identical across 67,194 SIMD-heavy functions. New stage test kuna-lanedivide-freefanout. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWRVoTEYHNosYwYRoSE
…g branch target, and say why a target has no row (#1370) `disassemble --follow` clipped a branch target's decode at the next row the fall-through path had already decoded, so a target inside a reachable instruction got no row, and its "decoded from" note counted the plain listing's skipped targets rather than what `--follow` anchored. A reachable decode is now kept however another path read the same bytes, so rows can overlap (as docs/cli.md promised); `--count` keeps the lowest-addressed rows and spends at most 4 decodes per row. Each target still without a row gets one stated reason (window end, budget, undecodable, or only unreached bytes name it), and the re-anchor note counts only targets that got a row. JSON `end`/`bytes` are the furthest row end; under `--follow`, `truncated` is set only by the 1024-instruction cap. The literal-pool fold needs contiguous rows, and the web study view's bytes and asm panes handle overlapping rows. Plain listings are unchanged. Fixes #1363. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWRVoTEYHNosYwYRoSE
|
[AUTOMATED] Pushed two commits. 3447b00: a PC-relative value kept its floor exemption through a low-byte read, so fa582af: merges main with #1366. |
… support (#1346) Add explicit big-endian Octeon, Octeon Plus, Octeon II and Octeon III targets (N64 and N32 soft-float). They lift bbit branches with delay slots, baddu/pop/dpop/seq/sne/seqi/snei, exts/cins and dmul, plus the II/III indexed loads, as ordinary p-code instead of generic special2()/getCopReg calls. On a target whose default data space is truncated (MIPS 64-32addr/N32, PowerPC e500 and 32addr, AArch64 ilp32), option truncptrflow (default on) runs RulePtrFlow, rebuilds a stack register wider than its address space as PIECE(upper, low) at entry, and skips RuleSelectCse visits of unheritaged outputs, so stack frames, stack arguments and pointer arithmetic are recovered; this costs about 10-50% more time on those explicit targets, and off restores the previous output. Untruncated targets are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWRVoTEYHNosYwYRoSE
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWRVoTEYHNosYwYRoSE
Brings in the Go options pushed to main since #1346 (gobounds, the Go write-barrier guards, Go 1.18 struct offsets) plus #1298 and #1371. clonephiorder sits on top; every count is re-derived from phases.toml and the test directories: 356 settables, tiers 127 core / 137 transform / 92 analysis, 164 with a live field, 355 "},\n" separators, 356 fixture rows, KUNA-CATALOG #15 = 362, corpus 625 files (83 datatests + 542 stages). docs/options.md and phase_catalog.json regenerated with the merged build. docs/baseline-stages.json re-recorded on the merged tree: main's set plus RETCOPYCLONE #1-#9, with KUNA-CATALOG #15 renamed (3417 assertions). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWRVoTEYHNosYwYRoSE
In a zero-based image,
kuna xrefsdrops an address the program forms from the program counter when the address is below0x1000. Take the issue's assembly, linked as an arm64 dylib (clang -arch arm64 -dynamiclib fixture.s -o fixture.dylib; this layout puts_audit_targetat0x2d0):_audit_addressisadrp x0, 0x0; add x0, x0, #0x2d0. The same miss happens to alea rdi,[rip+...]into the.rodatathat ld.lld puts first in a shared object or PIE, to_startpassingmainin an older x86-64 PIE, to anauipcpair, and to A32/Thumbadrin firmware linked at 0. With the fix:The fix:
mov x0,#0x2d0lifts the same asadrp. The newlisting/kuna_pcform.rsrecognises the forms from the encoding: AArch64adr/adrp, x86-64 RIP-relativelea, and A32/Thumbadr. It recomputes their value from the bytes, and only a constant equal to that value is exempt.auipc's own-address operand as PC-relative too. A value stays PC-relative through an add or subtract of something that is not. A difference of two (sub eax,r13dafter twolea [rip]), a mask, a shift or a truncation below 32 bits (movzx ecx,al) is a number. Values composed through the i386 PIC base are exempt too.0x1000. Every PIE and shared object does, and there it costs 6 to 24 ns per decoded instruction (0.1-0.4% of the walk over the x86-64, AArch64 and ARM C libraries and bash). A fixed-address executable walks exactly as before. This only changes the read-only xref query, so it has no option.Tests: five prebuilt fixtures (
lowpage_*: arm64 dylib, x86-64 and RV64.so, i386 PIE, ARM image at 0x100), each with acontrol_number(s)function that builds the same addresses as plain immediates.kuna-cli/tests/xrefs_low_page.rsfails on main for every PC-relative form and checks that the controls stay empty. Unit tests cover the encodings, the floor exemption, and the difference and truncation rules. Over 375 images (angr test corpus, fixtures, decbench PIEs, zlib linked by ld.lld for seven targets), no row is lost. 700 rows are added, and each one checks out as a PC-relative formation, either against capstone or GNU objdump or by hand. Emitted C is unchanged.Fixes #1364
🤖 Generated with Claude Code
https://claude.ai/code/session_013BBaWRVoTEYHNosYwYRoSE