tooling: scan the XMemAllocDefault/XMemFreeDefault call sites #1225
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1232"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T04:41:35Z.
Refs #126. This is the scanner-coverage slice: the attribute-word decode and policy in the issue's completion condition stay open.
Why
tools/xmem_attribute_scan.pyonly targeted the export namesXMemAllocandXMemFree, so call sites through theXMemAllocDefaultandXMemFreeDefaultaliases were invisible.src/xmem_shim.defexports the aliases (XMemAllocDefault=XMemAlloc @5,XMemFreeDefault=XMemFree @6), and a released image imports all four names by name. The alias imports have their own IAT slots and thunks, so a scan limited to the plain names misses those sites.Change
TARGETSnow listsXMemAlloc,XMemAllocDefault,XMemFreeandXMemFreeDefault. Each site already records the import name it used, so a site resolves to the alias it imported andXMemAllocDefaultis never reported asXMemAlloc. The report schema is unchanged, soFORMATstays 2.tests/cpu/xmem_attributes.asm/.def) gains three sites, 25 -> 28:default_alloc: a direct call throughXMemAllocDefaultwith constant word0x05e50000(heap, 32-byte alignment);default_free_tail: a tail jump throughXMemFreeDefaultwith constant word0xa8004000(memory type 5 graphics);cmove_guarded:mov edx,04000000h/cmp byte ptr [guard_flag],0/cmove rdx,rbx/call, whereguard_flagis a writable byte. The scanner deliberately classifies this shape ascomputed; the fixture now pins that classification and pins that the immediate before the compare is not reported as a word.tests/xmem_attribute_scan_check.pyasserts the four-name import list, both alias records (import name, slot route, call/jump transfer, word and classification), the computedcmovesite, and the new counts. No existing assertion was removed.docs/experiments.md: the "Attribute words at xmem call sites" section records the four-name coverage, the alias naming rule and thecmoveclassification, and notes that a physical-type or other word observed at such a site comes from a separate pass over the image, not from this scanner.Verification
Built from the
F:\x2w-xmemworktree on Windows with MSVC 19.52.37029.0, configured withcmake --preset dev -DINTAKE_PYTHON='C:/Users/trigg/source/repos/Xbox2Windows/out/pe-env/Scripts/python.exe'(configure did not needFFX_UPSCALER_IMAGE).The scanner's own summary for the fixture: 28 sites, 7 distinct words, 2 null words, 10 sites not fully constant.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T04:48:22Z.
Review: COMMENTED
Reviewed
288b1bf2on Linux (Windows MASM fixture build andxmem_attribute_scanCTest were not run locally).Diff & edge-case audit
tools/xmem_attribute_scan.py: extendsTARGETSto("XMemAlloc", "XMemAllocDefault", "XMemFree", "XMemFreeDefault"). BecauseTARGETSis matched directly against the imported symbol name for IAT slots, delay-load slots, and thunks, each site preserves the exact alias name (XMemAllocDefault/XMemFreeDefault) rather than folding intoXMemAlloc/XMemFree.tests/cpu/xmem_attributes.asm,tests/cpu/xmem_attributes.def,tests/xmem_attribute_scan_check.py: addsdefault_alloc,default_free_tail, andcmove_guarded(25 -> 28 sites), checking alias attribution and verifying thatcmoveafter an immediatemov edx+cmpreportscomputedwithout leaking the pre-cmpimmediate.docs/experiments.md: consistent with the code and 100% title-neutral.Linux checks (
/root/.local/share/x2w-rev-venv/bin/python -B)tests/xmem_attribute_scan_check.py: passed (decoding: 13 cases passed, exit 0)tests/form_coverage_check.py: passed (form coverage checks passed, exit 0)tests/docs_links_check.py: passed (16 Markdown files, 278 links, exit 0)tests/bidi_controls_check.py: passed (1038 tracked files, exit 0)git diff --check origin/main..HEAD: passed (exit 0)xmem_attribute_scanCTest (linkingtests/cpu/xmem_attributes.asmagainstxmem.dll): not run locally.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T04:41:47Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
288b1bfℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.