Commit Graph
2025 Commits
Author SHA1 Message Date
Eliran Zach 4e93e5a8d6 perf(contracts): shorten the shared detail parameter description (#16823)
* perf(contracts): shorten the shared detail parameter description

The detail input description is repeated on 42 tools in the default
tools/list. Shorten it from 523 to 369 bytes while keeping the omitted,
complete and summary semantics; delivery facts still name the budget and
recovery at the point of use.

Also drop a redundant inventory scan in the release-exposure container
reader: both callers already pass the occurrence digest resolved through
the nodeSha map.

* test(schemas): refresh advertised schema summaries for the detail description
2026-12-04 15:26:51 -05:00
Eliran Zachandmorluto 33b2763423 feat(artifacts): inspect PlayStation PS-X EXE headers (#16251)
* feat(artifacts): inspect PlayStation PS-X EXE headers

A file starting with the PS-X EXE magic is inventoried as psx-exe. Root
metadata reports the initial PC and GP, the text, data and BSS ranges,
the stack base and offset with the initial SP, the region marker and
its licensed region, and whether the file length agrees with 0x800 plus
the declared text size. header.bin and text.bin are stored ranges;
text.bin carries its load address and holds only the bytes present.

A file shorter or longer than the declared text, or a text size that is
not a whole number of 2048-byte sectors, leaves coverage unknown with
the offset involved. A file that ends inside the header is refused as
truncated with the offset where it ends. Nothing is executed.

* fix(artifacts): read PS-X EXE fields through BinaryReader and match regions exactly

A region marker such as constructor matched an inherited property of the
region table, so the metadata held a function and inventory failed when
it was cloned. Regions now come from a Map. Header words are read
through BinaryReader instead of a local decoder. The fixture writes
literal offsets with distinct non-zero values, including data and a
stack offset, and the guide says inventory reads the members to hash
them.

* fix(artifacts): validate PS-X file sizes and name the omitted text member

* test(artifacts): extract PS-X EXE members in the reader test

* style(artifacts): format the PS-X reader test

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-12-04 17:31:34 +00:00
Eliran Zachandmorluto d28ee2b639 feat(model): inspect PyTorch checkpoints and pickle opcodes statically (#16257)
* feat(model): inspect PyTorch checkpoints and pickle opcodes statically

inspect_model_artifact now reads PyTorch ZIP checkpoints, legacy torch.save
files and protocol 2-5 pickle streams without unpickling. A bounded static
walker (protocols 0-5) reports each stream's protocol and opcode counts and
every GLOBAL, STACK_GLOBAL, INST, OBJ, REDUCE, NEWOBJ, BUILD and EXT reference
with its offset, marking callables outside PyTorch's tensor-rebuild allow-list
as observations of what loading would import or call.

ZIP checkpoints report their archive prefix, version, byteorder and
serialization records and each referenced data/<key> storage; legacy files
locate every storage in the file. State-dict tensors get dtype, shape, byte
span and parameter counts, and names when one unshared key path reaches them.
Malformed opcodes, truncation and memo misuse are target failures with their
offset; max_pickle_opcodes and max_pickle_memo_entries bound the walk.

Refs #3652

* fix(model): address pickle walker and PyTorch interpretation review findings

- push APPENDS/ADDITEMS values one at a time instead of spreading them
- replace an equal key on SETITEM(S), as unpickling does
- refuse a FRAME longer than the remaining stream as truncated
- decode BINUNICODE with surrogatepass and validate raw-unicode-escape text
- unwrap _rebuild_parameter chains iteratively
- resolve tensor key paths once per node and charge names before building them
- inventory every storage persistent ID and require its storage bytes
- bound archive records in the MCP summary with record_count and records_omitted

* fix(model): bound pickle integers, ZIP names and keep partial facts

- validate but do not convert protocol 0 integers beyond an exact long; refuse inexact memo keys
- decode STRING with Python's escape rules, keeping unknown escapes
- fill the format peek before classifying the file
- read PyTorch ZIPs under the session member count with a bounded metadata read, charging names as they are listed
- retain completed pickle facts before full-file hashing
- mark tensor coverage partial when a rebuild call cannot be read

* fix(model): keep Python string identity and bound dict-key work

- record the exact code point sequence of strings holding Python surrogates, so distinct keys stay distinct
- build each key's identity once per node, so a reused memoized key is not rebuilt per write
- decode raw-unicode-escape text in bounded batches instead of one fragment per backslash run
- keep the first equal key when SETITEM replaces its value

* fix(model): scan raw-unicode-escape text in one pass

Measure each backslash run once instead of retrying a regular expression from every backslash, and build output without a per-escape list.

* fix(model): keep GGUF partial tensor data offsets non-null

* fix(model): bound pickle tensor counts and validate FLOAT operands

* fix(model): bound shared tensor work and read expanded views

* fix(model): format the pickle changes and drop the unused ModelFormat type

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-12-04 17:10:56 +00:00
Eliran Zachandmorluto 73582aa342 feat(native): identify Nim, Zig, GHC, OCaml and D toolchains (#16252)
* feat(native): identify Nim, Zig, GHC, OCaml and D toolchains

Add identify_native_toolchain, a static, read-only reader that reports
whether a local ELF, PE or thin or universal Mach-O image was built by
Nim, Zig, Haskell (GHC), OCaml or D, including stripped images without
a DWARF producer.

The reader searches a bounded part of the selected image for a fixed
table of runtime symbol names, runtime messages, mangled names, source
paths and producer strings, and returns each observed marker with its
file offset, section or segment, matched text and occurrence count.
Data sections are searched before bytes outside sections and before
instruction sections, so a bounded scan reaches strings first;
coverage reports the bytes examined.

The verdict is derived from the listed markers only: a language needs
two distinct markers, one strong. Conflicting, too few or no markers
give unknown, and a version is reported only when a marker states it.

* perf(native): order toolchain scan ranges in linear time

Intersect instruction sections with the bytes outside data sections in one pass, so an image with tens of thousands of sections does not take quadratic time before the scan starts.

* fix(native): bound stated toolchain versions and describe scan order

Track distinct versions per marker in a Set and list at most eight,
counting the rest in versions_omitted, so an image with many version
strings costs constant time per match and a bounded result. A candidate
reports a version only when exactly one was stated.

Describe max_scan_bytes and examined_bytes as a total in scan order
rather than a prefix from the image start, and place the chunk-boundary
test's marker across an actual read boundary.

* fix(native): keep every stated toolchain version in the report

* fix(native): bound stated toolchain version bytes before keeping them

* feat(native): make the stated version budget a per-call control

* fix(native): give no larger-limit retry once a toolchain control is at its maximum

* fix(native): do not match toolchain markers on truncated runs

* fix(native): keep exact markers on a final run at the image end

* style(native): format the toolchain changes

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-12-04 12:09:21 -05:00
Eliran Zachandmorluto 208b81d724 feat(artifacts): inspect Game Boy and GBA ROM headers (#16249)
* feat(artifacts): inspect Game Boy and GBA ROM headers

Game Boy and Game Boy Color images (game-boy-rom) are claimed when at
least the first 24 bytes of the boot logo at 0x104 match, the half every
boot ROM compares. Root metadata reports the entry code and its JP
target, full or top-half logo match, title and manufacturer code, CGB
and SGB flags, mapper and features, declared ROM and RAM sizes,
destination, licensee codes, version, and declared and computed header
and global checksums. The global checksum is summed over the file in
bounded reads.

Game Boy Advance images (gba-rom) are claimed from an ARM branch at 0,
the fixed 0x96 at 0xB2, and the boot logo or a matching complement
check. Root metadata reports the entry branch target, logo match, title,
game and maker codes, fixed value, unit and device type, version, the
complement check, and the multiboot fields when that layout could apply.

Both serve header.bin and program.bin as stored ranges. Logos are
compared by SHA-256 digest, so no logo bytes are carried. Checksum,
logo and size disagreements leave coverage unknown; a header cut short
is refused as truncated with the offset where the file ends.

* fix(artifacts): keep missing GBA multiboot fields unknown and pin checksum vectors

A GBA file that ends inside the multiboot fields reported boot_mode and
slave_id as zero. They are now null, with a limitation naming where the
file ends. The Game Boy reader charges artifact_limits.expanded_bytes
from the file size before it sums the file for the global checksum.
Checksum tests now use hand-derived vectors instead of copying the
parser's own result.

* refactor(artifacts): read Game Boy and GBA header fields through BinaryReader

The GBA parser decoded words with a local reader that read missing bytes
as zero. Both parsers now read header fields through BinaryReader, as the
tool-design guide requires, after their length checks. The fixtures write
literal offsets instead of the parsers' field constants, and the guides
say inventory reads the stored members to hash them.

* fix(artifacts): read documented GB size codes and MBC4, refuse truncated GBA headers

* style(artifacts): format the handheld ROM test

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-12-04 12:08:57 -05:00
morluto 785883b01d feat(website): use the v2 social preview under a new image URL (#16796)
The default sharing card shows the pixel wordmark beside disassembly, a
decompiled function, a hex dump and the agent workflow. The 1280 × 640
design is scaled to 1200 wide and extended with its own edge colours to
1200 × 630, so nothing is cropped.

Chat apps and social sites cache link previews by image URL, so Discord
still showed an older white card. The default card is now published as
assets/rea-social-card.png, which those sites have not cached.
2026-12-04 11:56:31 -05:00
morluto ca66ab63ba feat(website): improve search reach and complete 27 language editions (#16783)
* feat(website): lead search metadata with the REA tagline

Search results showed a generic homepage description, and rea.tools did not
rank for its own name, "Reverse Engineer Anything".

- Homepage title and description lead with "Reverse engineer anything,
  reimagine everything" in plain language, and the hero shows the tagline.
- Guide hub and first investigation titles match "how to reverse engineer
  an app with AI" searches.
- The English homepage publishes WebSite and SoftwareApplication structured
  data naming REA and "Reverse Engineer Anything", linked to GitHub, npm and X.
- The npm package homepage points to https://rea.tools.
- Translations of the changed messages keep 19 language homepages indexable.

* fix(website): match local search terms and list rea.tools in the MCP registry

Japanese and French coverage of REA uses なんでもリバースエンジニアリング and rétro-ingénierie, so the new titles and descriptions use the same terms. The MCP registry websiteUrl now points to https://rea.tools instead of the repository.

* fix(website): say the AI agent understands software, and repair blog descriptions

The homepage description now says REA lets your AI agent understand how any app, game or website works, translated for 19 editions. The blog index description had machine-translation errors in 8 languages, including Arabic rendering AI as Amnesty International; those are corrected.

* fix(website): rewrite Vietnamese translations for clarity

Replace machine-translated Vietnamese with natural wording across every
page: consistent terms for coding agent, case study, prompt and file,
correct breadcrumbs and number formats, and readable case studies, guides
and essays.

* fix(website): align translated titles and coding-agent terms

End translated titles with the same " — REA" separator as English, use
the established coding-agent term in German, Thai and Arabic, and fix the
French get-started title.

* feat(website): describe page breadcrumbs for search results

Search engines can show a page's place on the site (rea.tools > Guides > ...)
instead of a bare URL. The trail is read from each built page's visible
breadcrumb, so every language edition gets its own translated names.

* feat(website): add beginner and Ghidra/IDA guides and complete all 27 editions

New pages for people searching for reverse engineering itself:
"What is reverse engineering?", "Reverse engineering with AI" and
"Use Ghidra or IDA with an AI agent", linked from the homepage and guides.
The FAQ answers where to get REA safely, whether it is free, how it
differs from a Ghidra or IDA MCP server, whether it recovers source code
and whether reverse engineering is legal.

Case-study, browser and dinosaur pages get titles that match what people
search for, and the case-study index leads with "REA Examples".

Every translation was reviewed and largely rewritten where it was machine
translated, including wrong word senses, broken placeholders and, in Thai,
unrelated text. Malayalam, Roman Urdu, Romanian and Bulgarian are now
complete, and Hindi, Dutch and Bengali are new editions with READMEs. All
26 catalogs are fully translated, so no page falls back to English.

* fix(website): read breadcrumbs with an HTML parser and correct IDA support

Breadcrumb structured data now finds the trail by its class with an
HTML-aware parser, so extra classes, attribute order and line breaks no
longer drop a valid breadcrumb.

The Ghidra and IDA guide no longer promises callers or byte reads through
IDA, which no IDA profile provides; it suggests cross-references instead.
The example prompt is engine-neutral, the terminal example says how to
select IDA, and the ida-free-mcp choice warns that its 1.1.2 release
accepts connections from other computers until a firewall or a
local-only build restricts it.
2026-12-04 11:49:29 -05:00
morluto 78ac4ae5f6 feat(website): offer the reader's language when the browser prefers another edition (#16765)
* feat(website): offer the reader's language when the browser prefers another edition

Show a floating, dismissible offer in the browser's preferred language when
a complete edition of the page exists in it. The choice (picked, accepted or
dismissed) is remembered so the offer appears once. Offer and dismiss labels
come from each language's own catalog and never decide a page's translation
status, so a missing label cannot turn a translated page into a fallback.

* fix(website): keep the language offer to the reader's script and choices

- Chinese preferences offer only the matching script, then try the next
  browser language.
- Any saved language choice removes the offer, including choosing the
  current language on a page with a fragment.
- Middle-clicking a language link records the choice.
- The back-to-top button is hidden while the offer covers the bottom edge.
2026-12-04 10:51:56 -05:00
morluto a37994b3e8 feat(artifacts): inspect MetaTrader EX4 and EX5 program headers and resources (#16501)
* feat(artifacts): inspect MetaTrader 5 EX5 program headers and resources

Recognize compiled MQL5 programs by their EX5 magic and inventory them
through inspect_artifact and extract_artifact. Report the program type,
compiler build, copyright/link/version property slots, nonzero header
fields of unknown meaning, and the resource table. List the opaque body
and resource payloads as stored byte ranges; nothing is decrypted,
decompressed or decompiled.

Refs #16495

* feat(artifacts): read MetaTrader 4 EX4 programs with the EX5 layout

EX4 (magic EX-) shares the EX5 header, property slots and resource
table, so both containers become one mql-program format with a
container field. The version slot is 64 bytes and the opaque body
starts at 0x2E8 in both containers; the earlier 0x3A8 header length
counted 192 opaque bytes as part of the version slot. EX4 type code 3
is a library; build is reported under a neutral name because its EX4
meaning is not established.

* fix(artifacts): bound repeated MQL resource ranges and let tar outrank printable magics

Resource records may share one payload range, and each occurrence is
hashed and extractable, so the reader now charges every record against
artifact_limits.expanded_bytes, as the DTBO reader does.

A checksum-valid tar header now runs before the recognizers that match a
printable magic at offset 0. A tar whose first member was named EX-...,
GDPC... or UnityFS was claimed as an MQL program, Godot PCK or UnityFS.

Slot text keeps a leading U+FEFF, which is declared content rather than
an encoding mark.

* fix(artifacts): refuse an invalid tar header only after leading-magic formats

Only a checksum-valid tar header outranks the printable leading magics. A
Godot pack can hold ustar at 257 inside its own content without a valid
tar checksum; refusing that header first rejected the valid pack.

* fix(artifacts): compare MetaTrader resource declarations

A resource's name, kind, record index and unpacked size live in the
resource table, outside the stored payload that content comparison
hashes, so a renamed resource compared as unchanged. Compare them as
the resource's declaration, as tar, ar and UnityFS members do.

* fix(artifacts): keep unreadable MetaTrader resource names unknown in comparison
2026-12-03 19:16:36 -05:00
morluto 35d0d013c1 fix(artifacts): report an unrecognized file's leading bytes and working fallbacks (#16508)
* fix(artifacts): report an unrecognized file's leading bytes and working fallbacks

A file no format route recognizes was refused with only the raw-binary
load as recovery, which suits headerless machine code but not data
containers. The refusal now reports the file size and first 16 bytes,
names inspect_byte_entropy and inspect_yara_matches, which accept any
file, and keeps raw-binary for machine code. The REA skill gains a
workflow for continuing analysis when no route recognizes a file.

* docs(development): require recovery fallbacks to fit and accept the refused input

* docs(skill): describe entropy ranges as places to inspect, not content labels
2026-12-04 00:02:34 +00:00
Vincent Koc 472db72f3e test(clients): share JavaScript fixture literal assertions (#16502) 2026-12-04 07:15:43 +08:00
RRFZ fe29cab95a test(ida): compare verifier reads in one database state (#16483)
* test(ida): compare verifier reads in one database state

With IDA Pro 9.5, decompiling a function applies its inferred prototype
and can merge adjacent stack slots in the live database. The verifier
read the dossier before its first pseudocode, then compared
procedure_assembly and read_function_instructions with it after that
pseudocode, so the public fixture's rea_fixture_add failed parity.

Keep the CLI/MCP dossier comparison, which both read before any
decompilation, and compare the later MCP reads with a second dossier
read in the same post-decompilation state. Document the behavior and
the IDA 9.5 Windows x64 headless run.

* test(ida): cover verifier reads after a frame change

The verifier fixture always returned the same assembly, so pointing the
later assembly or instruction comparison back at the first dossier still
passed. The fixture now changes main's assembly once it has been
decompiled a chosen number of times: a change after the MCP dossier's
decompilation must pass, and a change before the assembly or instruction
read must fail in that phase.

Drop the second dossier's address, name and pseudocode assertions.
procedure_pseudo_code already compares later pseudocode with the first
dossier, and a second dossier for another function fails the assembly
comparison.

* test(ida): check the post-decompilation dossier's identity and pseudocode
2026-12-03 17:19:13 -05:00
Vincent Koc 5cfc8edb98 refactor(evaluation): summarize scenario totals in one pass (#16481) 2026-12-03 21:37:38 +00:00
Vincent Koc 2f0bfa1f31 refactor(release): render only the selected contribution format (#16469) 2026-12-03 20:49:47 +00:00
Vincent Koc 0f3ef088a9 refactor(licenses): split runtime notice headings once (#16435) 2026-12-03 18:51:29 +00:00
Vincent Koc 86a378455c refactor(test): derive project groups at declaration (#16418) 2026-12-03 17:45:22 +00:00
Vincent Koc c2b3ca2b11 refactor(ci): simplify portable test failure details (#16415) 2026-12-03 17:34:10 +00:00
Vincent Koc f58f8d8afa refactor(test): reuse sorted discovery inventory (#16413) 2026-12-03 17:25:54 +00:00
Vincent Koc f3c6dcfd08 refactor(mcp): share catalog pattern change formatting (#16410) 2026-12-03 17:16:47 +00:00
Vincent Koc 634b893269 refactor(build): share Cargo artifact path deduplication (#16407) 2026-12-03 16:54:36 +00:00
Vincent Koc 096f25ba23 refactor(ci): share static task receipt hashes (#16404) 2026-12-03 16:41:05 +00:00
Vincent Koc 89ecc756bb refactor(ci): share portable cache file requirements (#16401) 2026-12-03 16:26:24 +00:00
Vincent Koc c3634c71fb refactor(release): share editorial reference membership (#16398) 2026-12-03 16:11:30 +00:00
Vincent Koc 7094cd4b5e refactor(ci): share PR detail identity normalization (#16395) 2026-12-03 15:52:36 +00:00
Vincent Koc f7ee741fdb refactor(website): share head and title parser state (#16391) 2026-12-03 15:26:24 +00:00
Vincent Koc 42337906b6 refactor(ci): share job timing percentile summaries (#16389) 2026-12-03 15:19:37 +00:00
Vincent Koc bfe132cc01 refactor(ci): share duplication report clone-file schema (#16384) 2026-12-03 14:59:27 +00:00
Vincent Koc d470cc88b6 refactor(build): share Cursor plugin metadata reads (#16382) 2026-12-03 14:56:48 +00:00
Vincent Koc 791d3c665b refactor(build): share generated skill text normalization (#16375) 2026-12-03 14:23:24 +00:00
Vincent Koc 62a620b949 fix(deps): use patched tar in the private Skills verifier (#16168) 2026-12-03 21:47:56 +08:00
gensokyo-dev 766c45de1d feat(firmware)!: replace the literal-pool and split-immediate MMIO tools with inspect_firmware_mmio
inspect_firmware_literal_pools and inspect_firmware_mmio_synthesis answered
the same question and differed only in the instruction idiom they decode.
One tool, inspect_firmware_mmio, now takes a single architecture vocabulary
across all nine ISAs and dispatches to the literal-pool or split-immediate
decoder.

Both decoders write the same report:
- accesses rows: instruction, address register, access kind and width,
  address and MIPS physical address, region kind, architectural block, and
  CMSIS-SVD peripheral and register facts;
- a source object with the decoder's own facts: pool slot and disassembly,
  or pattern and high instruction;
- decoder facts on the report.

firmwareMmioGroups.ts owns grouping MMIO accesses by SVD peripheral,
architectural block or 4 KiB page. mmioAttributionBasis owns the group
basis. The retained view kind is firmware-mmio, with collections accesses,
peripheral_groups and anomalies, and its summary lists the top 16 groups as
compact rows.

max_references and max_syntheses are removed, since max_representation_bytes
already bounds the rows they counted. The literal-pool pre-allocation
measurement now includes an upper bound for each group, so its refusal
reports the exact required bytes. max_scan_bytes defaults to its 16 MiB
maximum, so one call covers a whole application image. mmio_only, default
true, now also drops literal-pool constants that are not MMIO;
counts.candidate_accesses still counts every decoded access.

BREAKING CHANGE: inspect_firmware_literal_pools and
inspect_firmware_mmio_synthesis (CLI inspect-firmware-literal-pools and
inspect-firmware-mmio-synthesis) and the retained view kinds
firmware-literal-pools and firmware-mmio-synthesis are replaced by
inspect_firmware_mmio (inspect-firmware-mmio) and view kind firmware-mmio.
isa becomes architecture, max_svd_nodes becomes max_svd_xml_nodes, and
max_references and max_syntheses are removed. Neither old tool has been
released.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-03 21:19:29 +08:00
Vincent Koc d422981f4d refactor(docs): share product catalog reference checks (#16340) 2026-12-03 12:29:16 +00:00
0af842ad26 feat(firmware): disassemble RISC-V, MIPS32, PowerPC, and ARM64 split-immediate MMIO accesses (#15413)
* feat(firmware): disassemble RISC-V, MIPS32, PowerPC, and ARM64 split-immediate MMIO accesses

* fix(firmware): tighten SVD interval inheritance and split-immediate register tracking

* fix(firmware): bound inherited SVD block expansion and decode exact destination GPRs

* fix(firmware): clear Rs across acquire-ordered ARM64 CAS and CASP variants

* chore(mcp): sync advertised schema summary and budget projection with main

* fix(firmware): bound CMSIS-SVD numeric widths before BigInt and index expansion

* fix(firmware): keep rejected SVD addressBlocks distinct from omitted spans

* fix(firmware): bound MMIO representation growth and preserve SVD ambiguity

* perf(firmware): memoize SVD address lookups and pre-rank peripheral names

* fix(firmware): scan a whole application image by default for MMIO syntheses

On the 1.36 MB IROM segment of the MicroPython 1.24.1 ESP32-C3 image, a
default call scanned 256 KiB and kept 512 of 713 matching accesses. The
omitted rows were not in the retained Evidence, so the agent had to repeat
the call with larger controls or page by scan_offset. Defaults now scan
4 MiB and keep up to 32,768 syntheses within a 16 MiB representation
allowance, matching the literal-pool tool. Retained summary delivery still
sizes what reaches the agent. The image completes in about 1 s with 4,073
syntheses.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* refactor(firmware): use MMIO synthesis maximums as their defaults directly

The default scan, synthesis and representation constants only repeated
their maximums, which Knip reports as duplicate exports. The budgets and
the parser fallback now name the maximums.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(firmware): bound SVD match cache weight, exclude RISC-V flash, and report scan-limit stops

---------

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-03 17:22:49 +08:00
04d473ca0b feat(firmware): disassemble ARM and Xtensa PC-relative literal-pool MMIO loads (#14447)
* feat(firmware): disassemble ARM and Xtensa PC-relative literal-pool MMIO loads

Disassemble PC-relative literal-pool load instructions (`arm-thumb` 16-bit
LDR and 32-bit Thumb-2 LDR.W, `arm-a32` LDR, and `xtensa` L32R) from local
firmware images at an explicit `base_address` without target execution:

- Byte-granular `PoolByteBitset` suppresses forward and backward pool byte
  ranges even at `4k + 2` unaligned file offsets (`base_address` ending in 2).
- Two-pass Xtensa pool discovery preserves `L32R` alignment after leading or
  interleaved 4-byte literal pools and preserves valid `21 36 01` encodings.
- Indexed `O(log M)` CMSIS-SVD disjoint `<addressBlock>`/`<register>` matching
  with cycle-safe multi-hop `derivedFrom` resolution, `mapped_image` bounds
  precedence, exact ARMv7-M/v8-M SCS sub-blocks, and `arm-a32` SoC neutrality.
- Cooperative `setImmediate` event-loop yields with `AbortSignal` cancellation,
  complete retained Evidence with `detail: "summary"` and `inspect_analysis_view`
  (`firmware-literal-pools`), `max_svd_nodes` parameter budget, and
  field-specific `invalid_request` validation.

* fix(firmware): bound SVD and candidate memory, preserve overshadowed loads, and report required_value

* fix(firmware): resolve SVD derivedFrom chains iteratively and restore lifecycle test title

* fix(firmware): bound Xtensa trace and SVD representation memory, make Evidence cooperative, and preserve unaligned literal loads

* fix(firmware): retain completed literal-pool scans on late cancellation and avoid repeated SVD string hashing

* fix(firmware): walk SVD register clusters, sweep dense overlaps linearly, and preserve XML depth recovery

* fix(firmware): enforce profile-wide cooperative SVD cluster expansion budget and sync schema

* fix(firmware): pre-parse SVD cluster templates, inherit defaults, and keep Xtensa framing

* fix(firmware): share inherited SVD template chains and count compact arrays as single intervals

* fix(firmware): replace SVD override chain links with persistent O(log K) treap

* fix(firmware): default max_references to the representation-bounded maximum

The IROM segment of the MicroPython 1.24.1 ESP32 image resolves 35,179
literal-pool loads. A default call scanned it and then refused at 16,384
references, so the agent had to repeat the whole scan with a larger
max_references. The count is checked after scanning, and
max_representation_bytes already bounds the Evidence these rows build. The
default is now the maximum; the same image completes in 1.4 s with a 12 MB
complete result.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* refactor(firmware): use the max_references maximum as its default directly

Knip reported DEFAULT_LITERAL_POOL_MAX_REFERENCES as a duplicate export of
MAX_LITERAL_POOL_REFERENCES. The budget now names the maximum as its
default, and the provider test reads the default from the budget.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(firmware): preserve inherited SVD register widths and addressBlock spans

---------

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-03 17:00:14 +08:00
bf7646b0c7 feat(firmware): classify privileged system-register, CSR, and port-I/O instructions (#14422)
* feat(firmware): classify privileged system-register, CSR, and port-I/O instructions

Add `inspect_procedure_hardware_instructions` (`rea inspect-procedure-hardware-instructions`)
to extract and classify architectural non-MMIO hardware instructions from
`read_function_instructions` across `arm`, `arm64`, `riscv`, `xtensa`, `mips`,
`x86`, and `x86_64`.

- Parse provider `<nativeAddress>: <assembly>` lines through the shared native
  address grammar (`OBSERVED_NATIVE_ADDRESS_PATTERN` / `nativeAddressInputSchema`)
  without stripping 2-hex-letter mnemonics (`dc`) or discarding address spaces
  (`rom:0x1000`, `overlay%3Aspace:0x1000`).
- Normalize conditional A32/T32 system, coprocessor, barrier, wait, and trap
  mnemonics (`mrcne`, `mcrgt`, `mrsne`, `msreq`, `cpsie.w`, `wfene`, `wfine`,
  `sevne`, `svcne`) while preserving original disassembled mnemonics, and cover
  AArch64 `dc`/`ic`/`at`/`tlbi` maintenance operations.
- Parse complete 8-bit immediate x86 port tokens (`0x00..0xff` across `0x`,
  Intel `h`, `$`/`#`, and decimal syntax), keep register-selected `DX` ports as
  `unresolved_register`, and separate symbolic or unparsed port tokens as
  `unresolved_operand`.
- Classify zero-source RISC-V CSR set/clear pseudo-instructions (`csrsi csr, 0`,
  `csrci csr, 0`, `csrs csr, zero`, `csrc csr, x0`) as `read` consistently with
  their canonical `csrrs`/`csrrc`/`csrrsi`/`csrrci` encodings.

Refs #7955

* chore(firmware): refresh the hardware-instruction advertised schema summary

The shared Evidence output schema on main now advertises its string
patterns, so the summary recorded on the older base was stale.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

---------

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-03 16:36:28 +08:00
CyberSprout 60d804050c feat(firmware): disassemble ARM A/R, Atmel AVR, and Motorola 68000 vector tables (#15404)
* feat(firmware): disassemble ARM A/R, Atmel AVR, and Motorola 68000 vector tables

* fix(firmware): preserve legacy vector views and tighten AVR/ARM-AR bounds

* fix(firmware): report truncated AVR vector slots and remove unused wrapper

* fix(firmware): enforce ARM A/R LDR pc target rules and slot-based table coverage
2026-12-03 13:02:09 +08:00
c50b1bae9d feat(firmware): propose CPU, endianness, and load-base candidates for firmware blobs (#14419)
* feat(firmware): propose CPU, endianness, and load-base candidates for firmware blobs

* fix(firmware): preserve MCP caller inputs, x32 decoder width, and bounded ELF tallies

* fix(firmware): leave M-profile variant and PPC width unresolved and report observed file size

* chore(firmware): remove unused exported types flagged by knip

* fix(firmware): recognize x86_64 leave;ret functions, keep uImage ppc width unknown, and preserve MIPS ELF flags

* fix(firmware): preserve MIPS/ARM decoder uncertainty and partial scan stages

* fix(firmware): preserve MIPS16 and microMIPS ELF ASE mode declarations

* fix(firmware): admit Cortex-M vector tables with filled reserved slots

The Raspberry Pi Pico SDK fills reserved vector slots with its default
handler. The detector required them to be zero, so it missed the vector
table and load base of the MicroPython 1.24.1 RP2040 image and offered only
an instruction-census guess. Reserved slots may now hold a Thumb handler in
the Reset region; any other value still rejects the table.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* feat(firmware): identify ESP-IDF images from their header chip_id

The detectors found no candidate for the MicroPython 1.24.1 ESP32 image.
They have no Xtensa signature, and the chip is named in the image header.
A new esp-image-header detector recognizes the ESP-IDF header at offset 0
or a ROM bootloader offset, and takes the ISA from the existing ESP-IDF chip
table. The chip_id field now has one reader shared with the ESP image
parser. ESP32 images report Xtensa and ESP32-C3 images RISC-V.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

---------

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-03 13:02:04 +08:00
Som SamantrayandYsopwnable cfaee2f5f7 feat(build): add non-turbo source-build path for freebsd (#15247)
* feat(build): add non-turbo source-build path for freebsd

* test(build): keep direct-build coverage runnable without turbo and reap build children

* test(build): use processTest fixture and long-running tag for build tests

---------

Co-authored-by: Ysopwnable <161784452+N0zoM1z0@users.noreply.github.com>
2026-12-03 12:46:27 +08:00
Vincent Koc b8947412f7 refactor(ci): share workflow identity validation (#16204) 2026-12-03 03:27:57 +00:00
Vincent Koc 1f72e699e4 refactor(signals): share CLI Evidence verification (#16170)
* refactor(signals): share CLI Evidence verification

* refactor(signals): supervise verifier subprocesses
2026-12-03 01:39:10 +00:00
Vincent Koc dcc17fd75a refactor(lint): share keyed first-match predicate patterns (#16163) 2026-12-03 01:03:09 +00:00
Vincent Koc 4155d6d936 refactor(lint): track ternary constraint state once per depth (#16159) 2026-12-03 00:42:39 +00:00
Vincent Koc 4579de3ddf refactor(wasm): reuse MCP artifact inspection in verifier (#16157) 2026-12-03 00:39:23 +00:00
Vincent Koc 8cacd2757d refactor(lint): share positional contract import resolution (#16153) 2026-12-03 00:19:22 +00:00
Vincent Koc b29d9d0a43 refactor(deno): share extracted text assertions in verifier (#16151) 2026-12-03 00:11:23 +00:00
Vincent Koc 369de39fbd refactor(managed): retain verified manifest method tokens (#16147) 2026-12-02 23:45:50 +00:00
Vincent Koc cdf12a874d refactor(managed): reuse parsed ILSpy import facts (#16145) 2026-12-02 23:44:20 +00:00
Vincent Koc e6e7420ed0 refactor(ci): collect fixed-ceiling facts in one AST walk (#16141) 2026-12-02 23:25:57 +00:00
Vincent Koc 7b247b4946 refactor(ci): share direct member checks for Darwin gates (#16136) 2026-12-02 23:23:46 +00:00
Vincent Koc d8e2593529 refactor(managed): derive completion claim IDs from scenario IDs (#16131) 2026-12-02 22:59:39 +00:00