Commit Graph
38 Commits
Author SHA1 Message Date
RRFZ 79c9aaa7f3 Retain scalar conversions and writable pair addresses (R3.11) 2026-11-18 08:53:21 -05:00
RRFZ e2df6bc410 Preserve pair writeback and split outgoing arguments (R3.11) 2026-11-18 08:49:22 -05:00
RRFZ f9f0866214 Keep pair destinations separate from register results and type scalar reads (R3.11) 2026-11-18 08:31:05 -05:00
RRFZ bdd284d030 Preserve A64 memory effects and truncated direct stores (R3.11) 2026-11-18 08:23:09 -05:00
RRFZ d1421498e6 Preserve argument loads across overlapping memory writes (R3.11) 2026-11-18 07:57:51 -05:00
RRFZ cc9d50fcfd fix(disasm): keep pseudo-C argument loads and Win64 stack arguments before writes that may change them (R3.11) 2026-11-18 06:53:25 -05:00
RRFZ ad81606a81 fix(disasm): read the source registers of A32 STRB, STRH and STRD (R3.11)
Only STR lifted as a store, so the other plain stores recorded the stored register as written, which dropped it from entry-block parameters and other dataflow. Their kind is unchanged.
2026-11-18 06:09:34 -05:00
RRFZ c93e201391 fix(disasm): keep spilled base arguments, loads before overlapping stores and store statements in pseudo-C (R3.11)
A memory-indirect call's base assigned in the block stays an argument after an earlier read of it. A folded load stays in place when a store before the call may overwrite what it read. A store's source register is no longer recorded as an assignment, which folded the store's statement away.
2026-11-18 06:05:26 -05:00
RRFZ 80740250b2 fix(disasm): keep base-register call arguments, A32 PC store addresses and import tail-call arguments
A memory-indirect call's base argument register is passed by name, valid A32 PC-relative stores keep their static address without becoming literal references, and import tail calls through ldr pc or jmp [slot] pass their register arguments and are recorded in Pseudo.calls.
2026-11-18 05:17:41 -05:00
RRFZ cdfeff5aca Preserve indirect-call target and base registers during pseudo-C argument folding (R3.11)
- Remove the `Flow::Call | Flow::IndirectCall` exemption around `defs.remove(r)` and `consts.remove(r)` in `Lifter::block` so registers read by indirect calls (callee pointers, memory-indirect bases/indices, and AArch64 PAC modifiers) retain their assignments instead of folding into callee argument lists.
- Add four integration regressions in `crates/disasm/tests/pseudo_indirect_call_target.rs` and update `docs/ROADMAP.md` and `docs/STATUS.md`.
2026-11-18 02:43:56 -05:00
RRFZ 2a5af743a1 Filter ARM32/Thumb SP and PC in value flow and canonicalize x86 call clobbers (R3.11)
- Scope `dataflow::ignored(mode, r)` so `"r13"` and `"r15"` are filtered as SP/PC bookkeeping only in `Mode::A32` and `Mode::T32`, preserving `r14` scratch reuse on ARM and general-purpose `r13`/`r15` reaching definitions on `Mode::X64`.
- Trim the fallback 32-/16-bit x86 `clobbered` list in `dataflow::def_use` to canonical `&["rax", "rcx", "rdx"]`.
- Add `dataflow_mode_registers` regressions and update `docs/ROADMAP.md` and `docs/STATUS.md`.
2026-11-18 01:17:08 -05:00
BFlat 768d24a49e Merge pull request #2084 from Plastic-time/bugfix/r3.11-arm-pc-literal-refs
32-bit ARM code keeps constants and addresses in small pools beside the code and loads them with `ldr rX, [pc, #off]`. Those loads recorded no reference, so strings, data and imported functions reached that way had no cross-references, and the stubs that jump to an imported function (`ldr pc, [pc, #off]`) weren't recognised as imports. The address each such load reads is now recorded, the stubs are named after the function they jump to, and the pseudo-C shows these 32-bit loads as `uint32_t`, not `uint64_t`.
2026-11-18 12:46:33 +07:00
RRFZ 56e4c4478d Record ARM32 and Thumb PC-relative literal references and GOT jump slots (R3.11) 2026-11-18 00:06:33 -05:00
BFlat 2a96867125 Merge pull request #2081 from Plastic-time/bugfix/r3.11-sbpf-ja32-and-jump-opcodes
In eBPF and Solana programs, `ja32` (opcode 0x06) is an unconditional jump whose distance is in the 32-bit immediate. It was decoded as a conditional branch using the 16-bit offset, so the jump went to the wrong place and the code after it looked reachable. It is now a plain jump to the right target. Three opcodes that no version defines (0x0d, 0x0e, and 0x9d before version 2) were read as `ja` or `exit`; they are now shown as unknown, while version 2's `return` (0x9d) is kept.
2026-11-18 11:56:40 +07:00
RRFZ 6f6442e2d6 Decode sBPF ja32 (0x06) as a 32-bit jump and reject invalid BPF_X jump/exit opcodes (R3.11) 2026-11-17 23:17:01 -05:00
RRFZ e939a5dad2 Preserve Thumb evidence across mixed symbol/export tag bits and escape STATUS pipe (R3.11) 2026-11-17 22:36:38 -05:00
RRFZ d36d4d38bc Select Thumb mode for entryless ARM libraries and normalize Thumb target addresses (R3.11) 2026-11-17 22:16:02 -05:00
BFlat e03c651588 Merge pull request #2073 from Plastic-time/bugfix/r3.11-pseudo-call-arg-deps
The pseudo-C folded an argument's assignment into the call that follows, even when a register that assignment read had been overwritten in between: `rsi = rdi; edi += 1; f(...)` showed the call taking the new `rdi` where it takes the old one. An assignment whose source register changes before the call is now left as its own statement, and the call is shown taking the assigned register or stack slot. This covers calls, tail calls and Win64 stack arguments.
2026-11-18 09:29:40 +07:00
BFlat f9c16904f3 Merge pull request #2066 from Plastic-time/bugfix/r3.11-overran-function-xrefs
When a function was scanned before the next function's start was known, it could run on into it; the second, trimmed scan fixed its blocks, but the references the first scan had recorded stayed and still counted against the limit. References are now kept per function, replaced when a function is scanned again, and the overall limit is shared out in the order functions were found, with freed room going to functions that had been cut short.
2026-11-18 09:14:27 +07:00
RRFZ 0a4720ea9d Invalidate pseudo-C call argument expressions when source registers change (R3.11) 2026-11-17 20:57:02 -05:00
RRFZ f866018713 Reconcile overrun rescans and clipped refills in one discovery-order pass and drop scan buffer capacity 2026-11-17 20:32:53 -05:00
BFlat aa2e6b9095 Merge pull request #2064 from Plastic-time/bugfix/r3.11-a32-reglist-reads-writes
For ARM32 and Thumb `pop`, `push`, `ldm` and `stm`, only the first listed register was treated as written and the rest as read, so `pop {r0, r1}` looked as if it read r1 and a load's base register looked written. Every register a `pop` or `ldm` loads is now recorded as written, every register a `push` or `stm` stores as read, and the base register as read (and written only with `!`).
2026-11-18 08:21:07 +07:00
RRFZ 92281edad9 Enforce global max_xrefs budget and discovery order across overrun re-scans 2026-11-17 20:09:39 -05:00
RRFZ 769ae52f12 Record implicit r13 read/write effects on Thumb pop and push 2026-11-17 19:48:50 -05:00
RRFZ 70ea7885cc Drop stale cross-references from re-scanned overran functions (R3.11) 2026-11-17 19:43:53 -05:00
RRFZ 1a1f9ae721 Record full register-list and base-pointer effects in ARM32/Thumb decoding (R3.11) 2026-11-17 19:11:26 -05:00
RRFZ dd4d9fa233 Lift AArch64 cmn conditions and skip zero-register writes in pseudo-C (R3.11) 2026-11-17 19:03:49 -05:00
BFlat fa4788e0d2 Merge pull request #2046 from Plastic-time/bugfix/r3.11-pseudo-string-slice-offsets
A reference into the middle of a string skipped that many characters, not bytes, so pseudo-C showed the wrong tail for wide strings and for text with multi-byte characters. The tail is now taken by byte offset (two bytes a unit for UTF-16LE), and a reference that lands inside a character is left as an address.
2026-11-18 05:55:29 +07:00
RRFZ b080cfd7b6 Slice UTF-8 and UTF-16LE string literals by byte offset in lifter (R3.11) 2026-11-17 16:36:45 -05:00
RRFZ ac26c8621c Resolve versioned and stubbed import arity in disassembler (R3.11) 2026-11-17 16:36:45 -05:00
YAO Changsong bd72993604 Keep the extension on AArch64 memory index operands (R3.11) (#1745) (#1745)
A register-offset AArch64 memory operand such as ldr w0, [x1, w2, sxtw #2] now keeps its index at its written width with its extension or shift, so pseudo-C shows the sign-extended index ((int64_t)(int32_t)w2 << 2) instead of a plain unsigned x2 * 4. An unchanged index stays plain, and x86 scaled indices render as before.
2026-11-12 14:54:11 +07:00
Afloat affed64ed1 Keep AArch64 address evidence tied to proven register values (R3.11) (#1601)
The AArch64 address tracker kept an old value after an addition with an unknown register, read unknown memory indices as zero, could keep a stale base after a load with writeback or a stale link register after a call, and did W-register additions in 64 bits, so stale values could name a later indirect call as an import its instructions didn't establish. Address facts are now kept only when the operands prove them: unknown addends and indices clear the result, W additions wrap at 32 bits, every register an instruction writes is forgotten before new facts are recorded, and calls clear the link register too.
2026-11-11 13:57:00 +07:00
Afloat 15bb58b686 Preserve the possible x16 input of authenticated returns (R3.11) (#1621)
With FEAT_PAuth_LR and PSTATE.PACM set, RETAA and RETAB use x16 as an extra modifier. The decoder knows neither the CPU's features nor PSTATE, so authenticated returns now also record a possible read of x16, beside their link register and stack pointer, and value flow keeps that input.
2026-11-11 13:14:40 +07:00
Afloat 25b7aca841 Preserve AArch64 inputs when arithmetic results are discarded (R3.11) (#1593)
The AArch64 decoder drops XZR and WZR from the register list, so for an ordinary arithmetic instruction whose result is discarded, the first remaining source register was marked as written. That false write broke reaching definitions and could erase a proven import-slot base before a later load and call. The discarded-destination rule, which covered only flag-setting instructions, now applies to ordinary arithmetic too, so those registers stay inputs.
2026-11-11 13:05:48 +07:00
Afloat 6c32b3b5a2 Preserve AArch64 control-transfer register effects (R3.11) (#1599)
Ordinary AArch64 returns treated the selected target register as a destination and unconditionally read `x30`, even for `ret x19`. Authenticated branches and calls had correct control-flow categories but fell through the generic operand-write rule, which overwrote their target's reaching definition. Authenticated returns also omitted their stack-pointer input.
2026-11-11 12:47:22 +07:00
Afloat 9c4f081e92 Bound native value-flow work before decoding instructions (R3.11) (#1598)
The value-flow graph decoded every instruction of every block and only then applied its node limit, so a huge function did all that work before most of it was thrown away. The node budget is now spent as nodes are made: parameters first, then instructions, and decoding stops once it runs out. Blocks that weren't decoded in full are tracked so their edges and definitions aren't treated as complete, and the graph is marked truncated.
2026-11-11 12:28:36 +07:00
Afloat b92931196d Preserve AArch64 exclusive-memory results and semantics (R3.11) (#1592)
AArch64 exclusive stores treated their status result as an input and never defined it, exclusive pair loads defined only their first result, and acquire-exclusive single loads were unknown operations. The value-flow graph lost the status edge into a retry loop's condition and the second loaded value, and pseudo-C could show an exclusive store as an assignment from its status register, or drop an exclusive load from a known import slot. Exclusive stores now write their status (unless it's discarded to WZR) and read their values, exclusive and acquire-exclusive loads are loads, pair forms define both results, and pseudo-C keeps them as memory operations.
2026-11-11 11:51:17 +07:00
BFlatandAfloat ebed13d0fc Keep ARM32 conditional call values, esbuild dependencies and window labels right (#656)
Replays #640–#642. Conditional A32 calls keep the skipped path's value, esbuild dependencies survive unrelated calls, and window comparison labels stay distinct without renumbering occurrences.

Co-authored-by: Afloat <132809511+Afloat16@users.noreply.github.com>
2026-11-03 20:49:11 +07:00