Add a source-built process-startup fixture for pe_map #164
Closed
opened 2026-11-21 17:50:35 +00:00 by raulmoracode
·
18 comments
No Branch/Tag specified
main
codex/indirect-large-backed-views
codex/word3-preflight-check
codex/vertex-table-two-records
codex/live-index-alias
codex/copied-vertex-buffer-srv
codex/windows-stage-test-output
codex/preserve-live-srv-retirement
codex/share-render-target-tracking
codex/sgd5-negative-offset-fixture
coverage-dashboard
codex/mesh-loose-root
codex/mesh86-cache-padding
codex/xmem-scatter-preflight
codex/mesh-depth-ps
codex/indirect-dispatch-refresh
codex/compute-container-index
codex/startup-compute-formatted-load
codex/compute-indirect-producer
codex/compute-atomic-soffset
codex/mesh-dual-handoff
codex/startup-run-sh-watcher-control
codex/queue31-page-alias
codex/indexed-indirect-compute-root
codex/typed-buffer-view-metadata
codex/translated-indexed-address-alias
codex/fixed-mesh-create-result
codex/xmem-section-lease
codex/startup-slot86-mesh-cache
codex/restore-mesh-barrier-iteration
codex/translated-indirect-upload-index
codex/xapu-completion-opt-in
codex/translated-indexed-rect
codex/translated-indexed-indirect
codex/startup-mesh-lds-integration
codex/startup-console-ms24
codex/startup-slot57-mesh-request
codex/indirect-copy-provenance
codex/present-color-producer-trace
codex/compute-dispatch-binding-trace
codex/translated-indirect-table-buffers
codex/indirect-copy-provenance-base
codex/mix-half-literal-source
codex/translated-indirect-draw
codex/xmem-scatter-diagnostics
codex/slot148-recording-upload
codex/slot70-loading-art-verified
codex/command-list-upload-arena
codex/recover-failed-command-list
codex/startup-heap-timing-notes
codex/align-audio-input-timeline
codex/synthetic-depth-export-control
codex/startup-texture1d-on-windows
codex/1629-packed-position-fixture
codex/cpu-srv-refresh
codex/stream-root-srv-draw
codex/audio-mixer-timer
codex/startup-reload-published-shader
codex/priority-integrate-1284
codex/guest-sixteen-page-record
codex/aot-placed-dxr-batch
codex/guest-directory-selection
codex/gamesave-enumerate-read
codex/readme-archive-to-pixels
codex/pe-placed-view-draw
codex/archive-directory-gpu
codex/slot133-dxr-build
codex/materialize-placed-vertex-view
codex/dstorage-directory-offsets
codex/xg-nine-bc-copy
codex/xg-slot10-bc64-arrays
codex/dxr-guest-address-readback
codex/gpu-va-high-bits
codex/clarify-diagnostic-startup-scope
codex/xg-six-levels
codex/typed-derived-blend
codex/english-legal-text-progress
codex/address-bc-4ks
codex/dstorage-bounded-file-read
codex/wide-srv-offsets-menu
codex/startup-memory-srv
codex/bound-view-tail
codex/language-selector-readback
codex/setup-menu-progress
codex/cpu-plane-refresh
codex/startup-ubyte-vertex
codex/presenter-window-selection
codex/startup-uniform-buffer-lane
codex/intro-loop-timing
codex/static-clzero-loops
codex/document-rtx-intro
codex/startup-insertq
codex/nv12-startup-texture
codex/stream-stage-draw
codex/startup-null-uav-format
codex/startup-draw-capture
codex/shorten-windows-checks
codex/dstorage-rfc1950
codex/startup-dump-fence
codex/pr1135-review-base
codex/startup-stream-requests
codex/startup-chroma-view
codex/readme-graphics-pipeline-streams
codex/static-crt-free-tls
codex/arc-140t-rtx-5080-laptop-gpu-reports
codex/main-startup-progress-entry
codex/signed-dxil-catalogue
codex/reloc-free-preferred-base
codex/quad-dpp-bit-mask
codex/raw-srv-bounds
codex/rx9070-31044-hardware-report
codex/gpu-page-source-provenance
codex/runtime-placeholder-interior
codex/gpu-copy-queue-tile-order
codex/pe-pin-external-providers
codex/xmem-placeholder-reservations
codex/xmem-shared-physical-pages
codex/pe-package-startup
codex/xmem-tools-memory-query
codex/cpu-stack-output-import
codex/pe-load-security-cookie
codex/record-three-bvh-retests
codex/cpu-rbp-frame-anchor
codex/xmem-default-startup
codex/record-rtx-3050-ti-9597
codex/docs-readme-start-here
codex/check-compute-mad24-truncation
codex/docs-discord-community
codex/bound-rcx-branch-mutants
codex/rtx5060ti-bvh-62114
codex/837-neutral-readme-disclaimer
codex/record-rtx-3070-ti
codex/title-neutral-public-wording
codex/exe-shadow-frame-submissions
codex/exe-shadow-runtime-chain
codex/readme-polish
codex/gpu-coverage-nov23
codex/spirv-minlod
codex/shadow-shim-device
codex/exe-two-shadow-frames
codex/shim-dispatch-cleanup
codex/fix-spirv-cache-probe
codex/sampler-use
codex/ballot-bit-extract
codex/packed-fma-release
codex/cpu-packed-fma-o2
codex/publish-coverage-dashboard
codex/mesh-cbv-binding-order
codex/spirv-window-fixture
codex/ps-e32-float-uint
codex/ps-cbuffer-reads
codex/fixed-profile-rescan
codex/shim-compute-integration
codex/readme-visible-coverage
codex/readme-research-navigation
codex/integrate-pr-256
codex/indexed-mesh
codex/sampled-coverage
codex/first-ms
codex/dual-ps
codex/ps-attribute
codex/compute-first
codex/ps-export
codex/readme-research-status
codex/ps-layout
codex/blast-window
codex/chart-caption
codex/reviewer-roles
codex/blast-aot
codex/archive-program
codex/crc-stream-program
codex/exe-image-data-chain
codex/local-cpu-fixture-coverage
codex/exe-bound-frame-chain
codex/exe-mapped-comparison
codex/contribution-dependencies
codex/exe-entry-aot
codex/bink-frame-heap-integration
docs/hardware-seven-reports
codex/bink-custom-heap
codex/bink-heap-callers
codex/discussions-entry-points
codex/gpu-community-batch-64
codex/ffx-scratch-writers
codex/generic-project-documentation
codex/ffx-dispatch-rcas
codex/four-windows-gpu-reports
codex/title-neutral-project-wording
codex/community-coverage-provenance
codex/rcas-packed-texels
codex/community-gpu-retests
codex/community-build-and-gpu-reports
codex/ffx-provider-loop
codex/ffx-recurrent-views
codex/ffx-recurrent-resource
codex/amd-wave64-reports
codex/ffx-backend-slots
codex/upscaler-device-init
codex/ffx-context-lifecycle
codex/ffx-version-query
codex/ffx-provider-contract
codex/typed-object-callback
codex/cpu-ordinal-import
codex/chained-cpu-ranges
codex/cpu-import-call
codex/cpu-direct-call
codex/cpu-leaf-aot
codex/community-project-status
codex/script-state-path-replay
codex/script-state-evidence
codex/bc7-resident-tail
codex/bcpack-mip-tail
codex/bc7-texture-draw
codex/asset-ranges
codex/pixel-constants
codex/pixel-aot
codex/pre-exe-workloads
codex/root-signature-device-coverage
engineering/packed-bvh-leaves
engineering/bvh-build-and-update
engineering/intake-root-roundtrip
community/gpu-check-release
community/english-contributor-entry
gpu-check-v0.1.0
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
R0Y00/Xbox2Windows#164
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 raulmoracode on 2026-11-21T17:50:35Z.
Question
Can
pe_mapstart a source-built image the way a normal Windows launch does: static initializers in dependency order, a TLS value read on two threads, and the entry point reached once?Today
pe_mapnever calls an EXE entry point.notify()returns early for a non-DLL image (tools/pe_map.cpp,IMAGE_FILE_DLLcheck), which is correct forLoadLibrarybut means the repository has no test where "startup" means more than "a DLL export returned". This is step 4 of the first-steps list in #132.Evidence so far
pe_mapalready reproduces DIR64 relocations, ordinary imports, section protections,.pdata, DLL TLS callbacks and the DLL entry point (docs/experiments.md, "Mapping an image without LoadLibrary" and "TLS callbacks and the entry point").cpu_native_tlscompares callback and entry-point order withLoadLibrary/FreeLibraryfor a DLL. It does not run an EXE.tools/pe_map.cpp). A startup fixture must either use callbacks only or state the limitation.IMAGE_FILE_DLLcleared: measured on Windows 11 build 26300,LoadLibraryWloads and frees the copy without calling the callback or the entry point.What a fixture would contain
main/WinMainthat returns a known exit code and writes an ordered marker log.Completion condition
A source-built EXE, mapped by
pe_map, produces the same initialization log and exit code as a normal Windows launch of the same EXE, and the negative control differs. The test records the log, not a claim that a title starts.Required environment
x64 Windows, MSVC with MASM, CMake/Ninja, Python 3.11 or newer. No game files, console or package DLLs.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by yummancito on 2026-11-21T18:34:04Z.
Hey, I've been working on a small proof of concept for #165.
I have a local, source-built CRT-free EXE fixture that runs through
pe_map, including a TLS callback and a resolved import. The mapped execution matches the native exit code (0x60d), and the negative controls detect the expected differences.It doesn't cover the full startup contract yet — particularly two-DLL initialization order, TLS data across threads, or CRT startup.
Would a smaller incremental PR for the EXE entry-point path be useful, or would you prefer waiting until the full fixture is implemented?
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by raulmoracode on 2026-11-21T18:36:35Z.
An incremental PR for the entry-point path would be useful. The repository's rule is one reviewable behavior per PR, and the entry point is independently testable: a CRT-free EXE with a known exit code, a TLS callback and one resolved import is already a complete differential case. Waiting for two-DLL order, TLS data across threads and CRT startup would make the first PR much harder to review, and would delay the first measured startup result.
A few details would make it easy to review:
pe_map_imagefor non-DLL images? The measured Windows behavior is thatLoadLibraryruns nothing for an EXE, so the opt-in path matters.0x60dcome from both sides?docs/experiments.md?I had planned the same fixture and will not open a competing branch. Once yours is up I can verify it on Windows 10 19045 with a full MSVC/SDK toolchain, and then take the two-DLL initialization order or the TLS-across-threads piece, whichever you prefer.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T18:39:15Z.
@yummancito, please send the incremental PR with your CRT-free source fixture and native/mapped comparison. The source, captured child-process output and exit-code check would also be useful for #210, which compares native and statically recompiled execution. We can share those pieces now while the two-DLL initialization order and cross-thread TLS checks proceed separately under #165.
Imported from R0Y00/Xbox2Windows. Originally posted by raulmoracode on 2026-11-21T18:42:20Z.
Thanks. I will verify the incremental PR on Windows 10 19045 (MSVC 14.44.35207, Windows SDK 10.0.26100) as soon as it is up, comparing the mapped run with the native child-process result. I will not open a competing branch.
After it lands I can take either the cross-thread TLS value or the two-DLL initialization order, whichever is unclaimed, and keep each as a separate PR so the first entry-point change stays reviewable.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by yummancito on 2026-11-21T18:45:10Z.
Thanks @R0Y00 and @raulmoracode!
I'll prepare the incremental CRT-free EXE PR first, with the source fixture, captured native child-process output, mapped comparison, exit-code checks and negative controls.
I've also started working on the two-DLL initialization fixture locally, so I'll keep that in a separate branch to avoid mixing the two changes.
@raulmoracode, the cross-thread TLS piece might be a good follow-up for you after the first PR lands.
I'll share the PR link here once it's ready. Appreciate the help!
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by yummancito on 2026-11-21T18:58:22Z.
Hey @R0Y00 and @raulmoracode!
The incremental CRT-free EXE PR is now up: #238.
It includes the opt-in
pe_map_runentry-point path, a source-built EXE fixture, native/mapped exit-code comparisons, TLS callback and import checks, negative controls, and reproducible documentation.The two-DLL initialization experiment remains separate.
Thanks again for the feedback and the offer to verify it on Windows 10!
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T19:14:08Z.
@yummancito, thanks for #238. I’m taking the integration with #228: run its existing EXE unchanged via your pe_map_run and the two existing provider DLLs, then compare both inputs against the native and translated child processes. I’ll exercise the first missing binding as a control and report any earlier mapping prerequisite. This uses your startup API and leaves the two-DLL initialization fixture to you.
Imported from R0Y00/Xbox2Windows. Originally posted by yummancito on 2026-11-21T19:22:07Z.
Thanks for the update!
Sounds good. I'll leave the #228 integration to you and continue working on the separate two-DLL initialization fixture.
We've already reproduced the native initialization order and exit code with a source-built EXE and two dependent DLLs. I'm now refining the CRT initialization and thread-notification tests.
I'll keep the changes isolated and avoid overlapping with your integration work.
Looking forward to seeing the results!
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T20:27:09Z.
#262 has landed. The native and mapped three-image fixture now compares the initialization log and exit status, including the reversed initialization control and explicit TLS values on worker threads. The DLL initializers in that fixture run from
DllMain. The remaining evidence here is the requested C++ static-constructor ordering and TLS callback observations on main and worker threads. Please build any follow-up on the merged fixture so its existing controls stay reusable.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T21:28:02Z.
#296 has landed (
2fa9be83). Its/MTDLLs use the real CRT entry and compare constructor, process attach/detach and destructor order between native and mapped loads. That covers the static-constructor evidence requested above. The remaining comparison is a TLS callback reading a thread-local value on the main thread and on a worker, with the observed thread identities and values under both loaders. #262 already supplies the EXE/worker and initialization controls.Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-22T20:51:59Z.
I took the implicit TLS data gap noted above:
pe_map_imagerejected every image with a non-empty TLS data template (MAP_UNSUPPORTED, "TLS data"), which #523 pinned. #698 makespe_mapaccept such images.Approach:
pe_mapdoes not write to the thread'sThreadLocalStoragePointerarray, which ntdll owns. It generates a small carrier DLL holding a copy of the relocated template, loads it withLoadLibraryExWso that Windows assigns the index and manages one block per thread, and stores that index at the image'sAddressOfIndex. The PR body lists the alternatives I ruled out and the known differences from a native load.Environment: Windows 10 Pro 22H2 build 19045, MSVC 2022 x64,
devpreset. A source-built fixture comparesLoadLibraryWwithpe_mapon the loading thread, a thread that existed before the load and a new thread. Windows 11 is not measured; a run there would be welcome.No open pull request touched
tools/pe_map.cppwhen I checked. If someone already has work in this area, say so and I will coordinate.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T04:20:11Z.
#698 merged as
00860ec. The mapper now serves source-built DLL TLS data through a Windows-assigned carrier index, with separate loading-thread, existing-thread and new-thread comparisons, plus failure and cleanup controls. Both Windows configurations and both Linux CI checks passed. Keeping this issue open for the standalone EXE startup fixture and its remaining acceptance checks.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T15:14:48Z.
Startup follow-up for #870, available to claim. Please check the existing loader TLS tests and extend the closest one with an initialized static TLS template spanning a page boundary and two callbacks. The callbacks should observe the initialized values in table order. Compare native and mapped execution on the initial thread and workers, and verify that a write on one thread does not change another thread's template. Include a negative control that detects swapped callback order or failed template initialization. Link related work before adding a fixture. Use source-built inputs and report the tested commit, commands, and Windows version here.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T16:09:10Z.
The cross-page DLL TLS slice landed in #883 (
406e14a). On both loaders, the two callbacks ran in table order on the initial thread and both concurrent workers, with each thread seeing its own writes. Both presets detected a swapped callback table and a damaged later page. The separate source-built EXE comparison remains open here, including the worker-thread TLS notifications and startup log for the EXE itself.Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-23T16:36:15Z.
Claiming the source-built EXE TLS comparison that is still open here (milestone #870).
pe_map_run/ thread notifications intools/pe_map.cpp, compared with a normal Windows launch. Todaynotify()returns early for a non-DLL image, so a started EXE's callbacks never see thread attach or detach underpe_map. A minimalpe_map.cppchange is in scope: oncepe_map_runstarts an EXE, forward thread attach and detach to its TLS callbacks only, never to its entry point.devandrelease.pe_map.cpp(security cookie); I'll keep my change outside that path.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-23T17:10:37Z.
EXE TLS result: #920.
Tested: commit
41b1de6(andef15a16before the last rebase). Windows 10 Pro 10.0.19045.6466, MSVC 19.44.35207.1 x64,devandrelease. The fixture is source-built and CRT-free.Commands:
cmake --build --preset <dev|release> --target pe_map cpu_exe_tls, thenctest --preset <dev|release> --no-tests=error -R '^cpu_native_exe_tls$' -V.Expected and observed (identical under a Windows launch and under
pe_map_run, both presets):callback order: m1 ran callers ['3', '1']) and a template zeroed from its page boundary (template mismatch on the first callback).Blocker found and fixed in the same PR:
pe_map_rundid not forward thread notifications to an EXE, becausenotify()skips non-DLL images. With the unmodified mapper, the test fails withnotifications for ['m1']. #920 forwards thread attach and detach to a started EXE's TLS callbacks only, never its entry point.Regressions:
cpu_native_{exe_start,startup,tls,tls_value,tls_data,lifetime,load_cookie}pass with the change on both presets.Scope: this checks the stage ahead of the current #870 import-binding boundary and does not move it. Process detach at exit and C-runtime startup are not covered.
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T17:42:20Z.
#920 merged at
af8fcba. On Windows and pe_map the EXE read the page-spanning template, ran both callbacks in table order, kept distinct values on the initial thread and two workers, and returned 0x20014 with identical logs. Both loaders detected a swapped callback table and a zeroed template page. This covers the EXE TLS slice; the issue stays open for the two DLL initializers in dependency order and the missing-initializer control. The source-built package work on #870 can supply that part.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T17:59:19Z.
Completed by #920 and #930, alongside the existing two-DLL negative control. The source-built package runner matches the normal Windows launch in dependency order, startup trace and exit status. The separate EXE TLS comparison checks per-thread data. Removing B's initializer gives atew2w3m1 and 0x1030200 where the normal package gives abtew2w3m1 and 0x103020e. Both Windows CI builds passed on the package runner.