[removed by author] #318

Manually merged
github merged 3 commits from gh-pr/318/head into gh-pr/318/base 2026-11-26 21:42:34 +00:00
Owner

@⁠thegl0w on GitHub · 2026-11-21 21:56 UTC · original
xmem/attribute-scan → main · +1100 −0 · 11 files · 3 commits · merged 2026-11-22 03:43 UTC

[removed by author]

**@⁠thegl0w** on GitHub · 2026-11-21 21:56 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/318) `xmem/attribute-scan` → `main` · +1100 −0 · 11 files · 3 commits · merged 2026-11-22 03:43 UTC [removed by author]
tools/xmem_attribute_scan.py reads a PE image without loading it and
reports, for every call or tail jump into xmem.dll's XMemAlloc or
XMemFree, where the attribute word in RDX comes from. It handles normal
and delay-load imports, and sites through the IAT slot, an import thunk
or a register loaded from the slot.

Code is decoded per .pdata function, with linear decoding between
functions. From each site the scanner walks backwards over the
function's control flow:
- jumps are followed, so joins report every distinct definition;
- a call on the path ends it as unknown, since RDX is volatile, while
  non-volatile registers are followed across calls;
- data loads are constants only from read-only sections, or from
  writable data that no RIP-relative instruction writes;
- reaching the entry resolves direct callers one level deep, and an
  exported function never counts as complete.
Anything else is computed or unknown, never a constant. Constant words
are classified with era_heap::allocate's desktop rules. A summary lists
the distinct words, null words and incompletely resolved sites, and
--fail-on-null and --fail-on-unresolved set the exit code.

xmem_attribute_scan checks two source-built MASM fixtures: 22 sites,
one per route and source form, plus one delay-load site. Their
negative controls cover a call clobbering RDX, an indirect jump, a
partial-register write, written data and an exported pass-through. The
13 decoding cases also run in the Linux Python job. Sixteen mutants of
the scanner each fail the check.

On the inspected package's 16 DLLs the scan finds five sites in two of
them, all constant: Bink's 0x05e50000 through linker thunks, and the
AMD upscaler's 0xa8004000 from a read-only section. These are the words
already pinned in era_heap_observed_words.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A load from a writable section was promoted to a constant when no RIP-relative instruction in
the image wrote the word. A write through a pointer can still change it before XMemAlloc, so
--fail-on-unresolved could report success for a word the scanner cannot know. Such loads now
stay data: the initial value and the RIP-relative writes found (written_at, possibly empty)
are kept as evidence only. Read-only loads still resolve.

The fixture gains pointer_written, which stores through an address held in RAX and then loads
the word RIP-relative into EDX; the earlier rule reported it as constant 0xa8004000. The
former data_constant case becomes data_unwritten. The delay-load fixture now checks that both
flags exit with 0 when every site is constant.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The platform-independent Python job runs tests/xmem_attribute_scan_check.py, so the Linux
list in docs/non-windows-hosts.md names it in the same place. The macOS list installs only
pefile, and the scanner also needs iced-x86, so it is left unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:42:33 +00:00
github manually merged commit 67017e5c4f into gh-pr/318/base 2026-11-26 21:42:34 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-22 02:43 UTC · original

The writer pass promotes an attribute loaded from a writable section to source="constant" when it finds no RIP-relative store. A write through a pointer to that word can change the value before XMemAlloc, but this branch would still make --fail-on-unresolved report success. Please keep the initial value and the absence of known direct writers as diagnostic evidence and classify that path as unresolved (unless immutability is independently established). Add a source-built case with a store through an address held in a register, followed by the RIP-relative load into EDX. The read-only constant cases should still resolve and the new case should trip --fail-on-unresolved.

**@⁠R0Y00** on GitHub · 2026-11-22 02:43 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/318#issuecomment-7073080226) The writer pass promotes an attribute loaded from a writable section to source="constant" when it finds no RIP-relative store. A write through a pointer to that word can change the value before XMemAlloc, but this branch would still make --fail-on-unresolved report success. Please keep the initial value and the absence of known direct writers as diagnostic evidence and classify that path as unresolved (unless immutability is independently established). Add a source-built case with a store through an address held in a register, followed by the RIP-relative load into EDX. The read-only constant cases should still resolve and the new case should trip --fail-on-unresolved.
github-bot changed title from tools: report the attribute word at each xmem call site to [removed by author] 2026-12-02 09:38:35 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.