Commit Graph
1590 Commits
Author SHA1 Message Date
3cfe8480c5 fix(elf): decode a 32-bit prpsinfo whose ABI gives pr_uid 32 bits (#10189)
* fix(elf): decode a 32-bit prpsinfo whose ABI gives pr_uid 32 bits

`decodeCorePrpsinfo` assumed every ELFCLASS32 core carries the i386/ARM `struct elf_prpsinfo`:
16-bit `pr_uid`/`pr_gid` and a 124-byte descriptor.

`pr_uid` is `__kernel_uid_t`, and its width is an ABI property, not an ELF-class one. Only
`arch/x86/include/uapi/asm/posix_types_32.h` and its ARM/m68k/sparc counterparts narrow it to
`unsigned short`; everything else takes `asm-generic/posix_types.h`'s `unsigned int`, so MIPS o32,
PowerPC-32, s390 and `compat_elf_prpsinfo` (`include/asm-generic/compat.h`:
`typedef u32 __compat_uid_t`) write a 128-byte struct with every member after `pr_flag` four bytes
later.

Reading a 128-byte descriptor with the 124-byte offsets published wrong values rather than null.
Measured through `parseElfNotes`, with `uid 70000, gid 80000, pid 4242, fname mips-proc`:

    before: {"pid":80000,"ppid":4242,"pgrp":1,"sid":4242,"uid":4464,"gid":1,
             "filename":"\u{10}","psargs":""}
    after:  {"pid":4242,"ppid":1,"pgrp":4242,"sid":4242,"uid":70000,"gid":80000,
             "filename":"mips-proc","psargs":"./mips-proc --serve"}

`pid` came out of the middle of `gid` and the two text fields came from the wrong offsets
entirely.

The kernel writes `sizeof(*psinfo)` as the descriptor — `fs/binfmt_elf.c`:
`fill_note(&info->psinfo, PRPSINFO, sizeof(*psinfo), psinfo)` — so the declared length already
carries the distinction and no machine table is needed. The 32-bit id width is now
`descriptor.length >= 128 ? 4 : 2`, and `pr_pid`/`pr_fname`/`pr_psargs` are derived from it. The
124-byte and 136-byte decodes are unchanged; the second new case pins that.

`src/native/elf` and `src/domain/native` — 535 passing. Forcing the 16-bit layout fails the new case.

* test(elf): produce the 32-bit prpsinfo layout from the shared note builder

Review finding: the regression hand-encoded a second NT_PRPSINFO layout while `corePrpsinfoNote` is
the repository's producer for this format, so nothing else could represent the MIPS/PowerPC/s390
ABI and the two encodings could drift.

`corePrpsinfoNote` takes `idWidth: 2 | 4` now. It allocates 124 or 128 bytes from it, writes
`pr_uid`/`pr_gid` at that width, and derives `pr_pid` through `pr_psargs` from `8 + idWidth * 2`
instead of the fixed 12/28/44 offsets. The option is ignored for a 64-bit image, whose layout is
fixed at 136.

Both new cases build their descriptor through the producer, so the test no longer carries offsets
the fixture does not know about.

* test(elf): drop the duplicate 124-byte prpsinfo case

The previous commit's rewrite left the original hand-built 124-byte block in place, so the same
regression ran twice — once through `corePrpsinfoNote`, once with the offsets written out again.
Keeping both is exactly the drift the shared producer was supposed to end.

* fix(elf): preserve SuperH PRPSINFO decoding

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
Co-authored-by: wunianze666-netizen <wunianze666@gmail.com>
2026-11-20 01:23:27 +00:00
RRFZ 31702dabd8 refactor(electron): carry fuse inspection limits from the reader (#12647) 2026-11-20 01:20:55 +00:00
morluto 939dd19efe fix(gpu): report the enforced parser limit (#12646) 2026-11-20 01:19:45 +00:00
morluto a37fee0543 refactor(elf): project unwind limits from parser failures (#12644) 2026-11-20 01:19:20 +00:00
RRFZ 04b47507dc refactor(pe): read CodeView directory declarations once (#12632) 2026-11-20 01:15:48 +00:00
morluto 21dfefcfb2 refactor(il2cpp): share stored native image scalar reads (#12638)
refactor(il2cpp): share native registration scalar reads
2026-11-20 01:13:26 +00:00
RRFZ bd70cf94ff perf(desktop): compare complete RGBA pixels in the screenshot readiness check (#12633) 2026-11-20 01:12:28 +00:00
morluto 6c7d69245e fix(crash): bound recorded core note source reads (#12634)
refactor(native): share recorded crash source reads
2026-11-20 01:11:57 +00:00
morluto d0ca65e524 refactor(elf): share fixed note descriptor reads (#12630) 2026-11-20 01:10:34 +00:00
RRFZ 22ead365e7 refactor(providers): share firmware and Flutter cleanup aggregation (#12618)
* refactor(providers): share firmware and Flutter cleanup aggregation

* test(firmware): check both cleanup failure records through retry
2026-11-20 01:03:56 +00:00
morluto c98b956da1 refactor(nativeaot): share mapped PE scalar reads (#12610)
refactor(nativeaot): share mapped scalar reads
2026-11-20 00:54:17 +00:00
morluto b8e65d24af fix(windows): retain target uncertainty when ExtraData overruns (#12612) 2026-11-20 00:48:15 +00:00
RRFZ f1ef301f36 refactor(apple): share Mach-O header and FAT slice field reads (#12611) 2026-11-20 00:45:29 +00:00
RRFZ 18f102d692 refactor(elf): read core file and auxiliary words through BinaryReader (#12606) 2026-11-20 00:27:17 +00:00
RRFZ d48f21bf87 refactor(nativeaot): read ReadyToRun directories within their PE section (#12592) 2026-11-20 00:19:20 +00:00
RRFZ 196f3a47b2 perf(ci): run Windows package verification alongside capability tests (#12588)
* perf(ci): run Windows package verification alongside capability tests

* fix(ci): verify the Windows cache writer on selected PRs
2026-11-19 19:18:21 -05:00
morluto a611944533 fix(windows): report unexamined bytes in shortcut item lists (#12594) 2026-11-20 00:09:51 +00:00
morluto cb380f0ab3 refactor(plist): share binary scalar and key reads (#12593)
refactor(apple): share binary plist scalar reads
2026-11-20 00:07:02 +00:00
morluto b2bb427553 fix(cleanup): report live resources independently of failed closes (#12589)
fix(cleanup): follow live resources across owner close failures
2026-11-20 00:00:10 +00:00
morluto 2b4442c0e9 refactor(ghidra): share DOS relocation word reads (#12585)
refactor(ghidra): read DOS relocation words through BinaryReader
2026-11-19 23:55:59 +00:00
morluto c8a783d7cf refactor(windows): share Shell Link location field reads (#12584) 2026-11-19 23:54:18 +00:00
RRFZandmorluto 6f3c016a5a refactor(native): read Mach-O initializer symbols and relocations with the image reader (#12571)
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-11-19 23:49:04 +00:00
morluto cddaef83ae refactor(elf): share fixed-width unwind field reads (#12574)
* refactor(elf): share fixed-width unwind field reads

* refactor(elf): share dynamic hash header word reads (#12577)

refactor(elf): share bounded hardening hash reads
2026-11-19 23:42:01 +00:00
morluto d95287056d fix(managed): bound CIL method headers to their PE section (#12575)
fix(dotnet): bound CIL headers to mapped section bytes
2026-11-19 23:37:16 +00:00
0e0c5a8fea feat(ghidra): admit ELFv2 PPC64 executables through a Power ISA 3.0 lane (#12517)
* feat(ghidra): admit ELFv2 PPC64 executables through a Power ISA 3.0 lane

An EM_PPC64 ELF has been classified in the powerpc family since #12089, but
the Ghidra lane still refused every ELF64 file. It now admits ELF64 ET_EXEC
files that declare the ELFv2 ABI, little or big endian, and imports them with
PowerPC:LE:64:A2ALT or PowerPC:BE:64:A2ALT by byte order.

Ghidra's 64-bit "default" languages decode the G2-era instruction set and
stop at the first VSX instruction in POWER8 or POWER9 code; the A2ALT
languages are Power ISA 3.0 and decode it. The ELF loader selects A2ALT
today, and the lane passes it explicitly and records it as provider-pinned.

ELFv1 (.opd function descriptors), an undeclared ABI, other e_flags bits,
ET_DYN and ET_REL are refused with their own reasons. The 32-bit lane is
unchanged.

npm run verify:ghidra:ppc64 builds a source-owned ELFv2 fixture in both byte
orders and checks it against GNU readelf and real Ghidra through MCP and the
CLI: the bound language, fixed instruction bytes including a VSX xxlor, the
global-entry thunk to each function's local entry, direct calls, snapshot
identity, and a shared object refused before Ghidra starts.

Refs #12085

* fix(ghidra): supervise PPC64 verifier compiler and CLI processes

Timeouts on bare execFile stop only the direct child, so a linker can
outlive Clang and disappear from the parent-tree cleanup check. Launch
those commands through the shared command owner, pass that runner into
the PPC64 fixture builder, and close the owner before the lineage check.
A failed close stays registered for retry and the diagnostic workspace
is retained.

* docs(ghidra): record the PPC64 ELFv2 Power ISA 3.0 lane

Add the feature specification, plan, and tasks for the lane, and index
them with the other feature records.

* fix(ghidra): finish shared PowerPC verifier command ownership

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-11-19 18:27:31 -05:00
ShuaixinHuangandShuaixinHuang 4bebd9a5e1 fix(release): validate the exact MCP registry package at checkpoints (#12550)
Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com>
2026-11-19 18:00:37 -05:00
RRFZ 2bfb5541c9 fix(sqlite): retain original failures when cleanup fails in multiple places (#12561) 2026-11-19 22:59:26 +00:00
679586b1c2 fix(ci): continue qualification lookup past unavailable runs (#12414)
* fix(ci): continue qualification lookup past unavailable runs

* test(ci): align inherited Mach-O assertion with main

---------

Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-11-19 22:59:09 +00:00
RRFZ 9ed9d6c8a2 refactor(apple): share fixed-width reads across dyld chained fixups (#12560) 2026-11-19 22:59:05 +00:00
a035813e55 fix(ci): bind timing history to the verified workflow source (#12555)
* fix(ci): bind timing history to the verified workflow source

* test(ci): reject timing history without valid commit lineage

---------

Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-11-19 22:56:52 +00:00
RRFZ 3e40979b42 refactor(native): share file-backed ELF and Mach-O initializer word reads (#12559) 2026-11-19 17:51:40 -05:00
RRFZ 5c3fe9caeb refactor(il2cpp): decode metadata tables through one shared binary reader (#12554) 2026-11-19 22:44:20 +00:00
RRFZ d51dd4a996 refactor(apple): read streamed Mach-O command fields through the shared word reader (#12552) 2026-11-19 17:37:18 -05:00
morluto 4edbbf0df9 refactor(go): share bounded string header word reads (#12553) 2026-11-19 22:35:22 +00:00
RRFZ d3d0355a9a refactor(kuna): share cleanup aggregation for commands and sessions (#12528) 2026-11-19 17:28:13 -05:00
RRFZ fa9abed521 refactor(process): inherit cleanup ownership for debugger cancellation (#12537) 2026-11-19 17:28:02 -05:00
RRFZ 4e30dbef14 refactor(pe): read icon group fields within their resource payload (#12547) 2026-11-19 22:24:24 +00:00
morluto 4892615ecb refactor(macho): share encryption command word reads (#12543) 2026-11-19 17:15:30 -05:00
morluto 9d0502bc51 fix(uefi): share inspection and extraction scan limits (#12538)
* fix(uefi): share inspection and extraction scan limits

* test(uefi): prove extraction honors the FFS file limit
2026-11-19 22:05:16 +00:00
morluto 0efd54e1c1 refactor(apple): share bounded JVM class field reads (#12540) 2026-11-19 22:04:16 +00:00
RRFZ d5e5aaa062 refactor(elf): read module version CRCs through BinaryReader (#12530) 2026-11-19 16:59:01 -05:00
RRFZ 756f772430 refactor(apple): share lazy dylib payload field reads (#12536) 2026-11-19 16:56:25 -05:00
RRFZ 503379b953 refactor(pe): read TLS and load configuration fields through BinaryReader (#12533) 2026-11-19 16:56:22 -05:00
RRFZ 846052b410 refactor(managed): share fixed-width GUID and user-string heap reads (#12535) 2026-11-19 16:55:46 -05:00
RRFZ 4ecc4f17a5 refactor(managed): share checked reads for metadata stream and table headers (#12526) 2026-11-19 16:55:41 -05:00
morluto 8fb1a3ce99 refactor(artifacts): share bounded NES header reads (#12524) 2026-11-19 16:29:37 -05:00
bartman081523andmorluto d380dc2409 feat(uefi): add pure-TypeScript UEFI firmware analysis tools (#12342)
* feat(uefi): add pure-TS UEFI firmware volume/FFS parser with inspect/extract tools

Add a dependency-free rea-uefi provider that maps AMI/Aptio flash images:
- inspect_uefi_firmware: aligned _FVH discovery, volume-relative FFS walking,
  guided section/compression classification, conservative PSP-directory probing,
  embedded-volume rescan and leftover-region classification; incremental SHA-256
  and explicit integrity notes.
- extract_uefi_firmware: whole-image/volume/FFS-file/section extraction with
  LZMA-custom/LZMAF86 and AMD-zlib decoding, SafeOutputTree staging, derivations
  and extraction_gaps.
- UefiArtifactReader + 'uefi' format wiring across inventory/domain/contracts
  so parsed volumes and extracted PE32/TE files hand off to deep-provider
  analysis (open_binary -> Ghidra).

* feat(uefi): add inspect_uefi_nvram for AMI NVRAM variable stores

Add a pure-TypeScript tool that maps the vendor AMI NVRAM variable stores
(factory-default "StdDefaults" and peers) inside a flash image:
- scan the raw image for NVAR entry chains ("NVAR" + u16 total size +
  u32 attribute 0x8[23]FFFFFF + state + NUL-terminated name + data),
- recurse into a container entry whose data is itself an NVAR chain, so the
  StdDefaults setup variables surface as depth/parent_offset rows,
- report attributes, state, data range, SHA-256 and trailing padding per entry.

Verified against B550 AORUS Elite V2 FId: one StdDefaults store at 0x37090 with
the 11 expected nested variables (Setup, PlatformLang, AMITSESetup, XhciDID,
GcSensorVarName, PCI_COMMON, SioSetupData, UsbSupport, NetworkStackVar,
SecureBootSetup, Setup). Exposed as MCP tool and inspect-uefi-nvram CLI command.

* fix(uefi): address review on checksums, compression, guided sections, NVRAM bounds

- FFS file checksum: verify the two's-complement invariant (payload sum +
  stored byte == 0 mod 256) instead of comparing sums, and encode the correct
  complement in the fixture builder.
- Compression sections (type 0x01): use the 9-byte header and classify EFI
  standard compression instead of 'none', so extraction reports a gap rather
  than publishing compressed bytes as a raw section.
- GUID-defined sections: derive GUID/data-offset/attributes from the parsed
  common header size (compact or extended) and reject out-of-range payload
  offsets.
- AMI NVRAM: bound recursive chains to the enclosing container's data end and
  report partial coverage when a valid nested chain is cut by max_depth.

* fix(uefi): bound decode memory, serialize operations, enforce deadline, mark truncation

- LZMA worker: enforce max_output_bytes while decoding through a bounded output
  sink, so an oversized stream is rejected during expansion instead of after a
  full decompression plus a second Buffer copy.
- Provider: serialize admitted operations (the promised single decode-worker
  lane must not become one worker per overlapping call) and apply one
  whole-request deadline that covers every decode stage, not a fresh per-stream
  timer. close() drains the queue and the resource scope.
- Scan: track truncated sections of known type and report coverage partial
  instead of complete when a section declares more bytes than are present.

* fix(uefi): cancellable queue, timeout surfacing, availability and reader omissions

- Queue: check the caller signal before enqueue and when a job reaches the head,
  and race the queued promise against abort so a cancelled wait returns
  immediately instead of blocking behind the active request.
- Deadline: track the internal deadline and return AnalysisTimeoutError instead
  of the AnalysisCancelledError that runOwnedCommand reports for any external
  abort, preserving the real failure reason for CLI/MCP callers.
- CapabilityInventory: treat inspect_uefi_nvram like the other bundled rea-uefi
  tools so discovery does not demand Unblob for it.
- UefiArtifactReader: report image truncation through onOmission so inventory
  coverage reflects the unread suffix even when no volume was found.

* fix(uefi): limit early cancellation to unstarted jobs and preserve timeout cleanup

- #raceWithAbort only returns early for jobs that have not started; once a
  request is running, await it so worker cleanup and completed output are
  preserved instead of being discarded by a bare cancellation.
- Reclassify a deadline-induced cancellation as AnalysisTimeoutError while
  keeping its cause and cleanup observations, and never override a different
  primary failure.

* docs(licenses): record UEFI decoder dependency notices

* fix(uefi): preserve stream provenance and bound firmware analysis

* feat(uefi): decode LZMAF86 guided sections

* fix(uefi): validate publication before commit and order decoder cleanup

* fix(uefi): preserve unsupported volumes and extraction gaps

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-11-19 21:19:35 +00:00
morluto b239ea8011 refactor(elf): share bounded note header reads (#12527) 2026-11-19 21:17:34 +00:00
RRFZandmorluto b824f9510d refactor(elf): decode REL and RELA entries through BinaryReader (#12522)
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-11-19 21:04:02 +00:00
RRFZ 84731eefdf refactor(elf): read IKCONFIG gzip and boot fields through BinaryReader (#12525) 2026-11-19 15:59:21 -05:00