Memory: link xcl.exe without high-entropy ASLR so title memory stays under 2^40 #631
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!631
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/631/head"
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?
@13hourstilliland on GitHub · 2026-11-24 02:41 UTC · original
13hourstilliland:memory-low-va→main· +30 −0 · 2 files · 1 commits · closed without mergingPart of #585. A retail title's XboxBvhBuilder refuses any acceleration structure whose GPU address is at or above 2^40. @sub-north's addresses in #585 are about 2.06 TiB, in write-watched reservations that go through
VirtualAlloc(NULL).The reason they are that high:
xcl.exeis linked with high-entropy VA (Rust's default), and with it Windows places a process's bottom-up allocations around 1 to 2.5 TiB. The title's memory lives in that process. Linkingxcl.exewithout it brings those allocations back near 2 GiB. That should also cover the fallbacks @sub-north found theVirtualAlloc2ceiling could not catch, with no change incrates/xcl/src.What is in it
crates/xcl/build.rs(new):/HIGHENTROPYVA:NO(MSVC) or-Wl,--disable-high-entropy-va(GNU) for thexclbinary only.crates/xcl/tests/low_va.rs(new): readsxcl.exe's PE header and fails if the high-entropy VA flag is set.Tested
x86_64-pc-windows-gnu(not MSVC), debug.VirtualAlloc(NULL, 24 GiB, MEM_RESERVE)×20, three runs each):0x1e1cb8a0000,0x1eda2c40000and0x23344380000; 20/20 above 2^40 in every run--disable-high-entropy-va: from0x7fff0000up; 0/20 above 2^40cargo test -p xcl --test low_va: fails onmainwithDllCharacteristics 0x160: high-entropy VA is on; passes with this change (0x140).cargo test --workspace --no-fail-fast -- --test-threads=4in an interactive session: 686 passed, 0 failed, 41 ignored, the e2e title test included. The same tree onmaincb868b2plus these two files.gpu_geometry_wave32_prefix_count_over_a_mask(no wave64). A Session 0 run of the same tree also printedgpu_wave32_program_in_wave64_hardware(no wave64).Regression run
None. I do not have a retail title.
scripts/pr_check.pydoes not ask for one here because nothing undercrates/xcl/srcchanges, but the change affects where every allocation in the process lands, so a smoke run is the real check. @sub-north, you hit this wall: would you runsmoke.ps1onmainand on this head?Not tested
/HIGHENTROPYVA:NOis a standard link.exe switch, but I built with GNU only).MEM_TOP_DOWNstill go to the top of the address space. This change does not cover them.xcl.exe, one of my workspace runs kept a stale binary with the flag still set.cargo clean -p xclfixed it, and every later run was consistent.AI use
Claude Code (Claude Opus 5.5): found the cause, wrote the change and the test, ran the probe and the tests on the PC above, and wrote this description.
@LocranKing on GitHub · 2026-11-24 03:08 UTC · original
Tested the MSVC build (
x86_64-pc-windows-msvc) and retail smoke run on NVIDIA RTX 3060 Ti.Tested
12be9306269772e1e24aa1e44219f2bce684c193(pr-631, clean tree;cargo clean -p xclbefore building)8024 MiB VRAM, driver32.0.16.2101),rustc 1.100.0(x86_64-pc-windows-msvc, MSVC14.44.35207), DXC1.9.2602.17(SDK10.0.26100.0),--releasecargo test --release -p xcl --test low_va: 1 passed, 0 failed (xcl_exe_is_linked_without_high_entropy_va ... ok)cargo test --workspace --release --no-fail-fast -- --test-threads=4: 686 passed, 0 failed, 41 ignored, exit0;2 (no wave64)skipped (gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware)xcl.logon the retail smoke run: all relocated console DLLs and UMA windows landed well below2^40(e.g.vcruntime140.dll @ 0x16d0000,xboxbvhbuilder.dll @ 0xa6a0000,libhttpclient.gdk.dll @ 0xa780000,window 0 buffer at VA 0x300000000, coherent window at0x400000000, console buffers0x700010000).Regression run (
scripts/smoke.ps1, 60 s,XCL_NETWORK=0, title folder name redacted)main (
dd2ae9a):PR #631 (
12be930):(Note on the lower frame count:
#631is branched off an oldermainbefore#636/#602, and during this run free system commit was17342 MB<17408 MB, so XCL kept a 512 MB coherent window.)Not tested: World streaming / live
XboxBvhBuildercalls past the start screen, debug build, GNU target.AI use: Antigravity (
Gemini 4 Hydrogen) ran the builds, tests, and smoke run and drafted this report from the actual command outputs and logs.@Chrysana on GitHub · 2026-11-24 03:33 UTC · original
Test report for
12be931on AMD RDNA4 with the retail title, which is the card in #586: with this PR, the acceleration-structure addresses the title hands its BVH builder are under 2^40; onmainthey are all above it. The runs below didn't reach the builder's check itself (see the last point under Long runs).Setup: AMD Radeon RX 9070 XT 16 GB, driver 32.0.32015.2008, Ryzen 7 9800X3D, 31 GB RAM, Windows 11 25H2 build 26200.9974, rustc 1.100.0
x86_64-pc-windows-msvc, DXC 1.9.2602.17. Retail title 1.0.2.1,XCL_NETWORK=0. Debug build for the tests, release builds for the runs.The link flag (MSVC):
xcl.exeDllCharacteristics:main63cdc25=0x8160(high-entropy VA on);12be931=0x8140(off).cargo test --workspace --no-fail-fast -- --test-threads=4at12be931: 686 passed, 0 failed, 41 ignored;xcl_exe_is_linked_without_high_entropy_vapasses.SKIPPED: the two debug-layer tests (the D3D12 debug layer isn't installed here).tests/low_va.rsalone onmain63cdc25(withoutbuild.rs) fails withDllCharacteristics 0x8160: high-entropy VA is on.Where the title's memory lands (from
xcl.log; 2^40 =0x100_0000_0000):mainkernelx: reservation … 0x600000000 bytes)0x149e4010000,0x1d97c850000,0x285e2a60000,0x2a6ffec00000xd20000000in all 5 runsCreateShaderResourceView(RAYTRACING_ACCELERATION_STRUCTURE)addresses0x1dfda360000–0x1dfdd946f000x1947a0000–0x197d81d00Long runs (240 s,
XCL_PRESS_A_AT=20,25,30,main63cdc25and this PR's head):mainthe acceleration structures are set up at the high addresses above, as in #586 / #585.XDXR Errorline in either. Both end in the title's GPU watchdog first (0xc0000005write of 0 at+0x23cf683, the deliberate stop from #505 / #534):mainat 163.6 s, this PR at 153.7 s, with presents falling to 0 beforehand in both. So these runs show the addresses fixed, not the throw avoided.Regression run:
scripts/smoke.ps1 -Game <folder> -Seconds 60,XCL_PRESS_A_AT=14,17,21, same saved state, two rounds. This PR is 15 commits behindmain, so it was also merged ontomain63cdc25(clean, local merge52de9e9, not pushed):main63cdc2512be931merged onto63cdc2512be931(its own basecb868b2)All runs reached the intro video; no crash or device removal.
main:PR merged onto
main:PR head:
Not tested: the BVH builder's check passing (the watchdog stops both runs first);
MEM_TOP_DOWNallocations; the low-commit fallback from #586's log (UMA: … under 17408 MB), which this machine didn't hit in these runs.AI use: Claude Code with Claude Opus 5.5 built the commits, ran the tests, the negative control and the title runs, read the logs, and wrote this report. The runs were made on my machine.
@RomeXDR on GitHub · 2026-11-24 04:04 UTC · original
Test report for
12be930: the BVH builder's check passes with the retail title (1.0.2.1). That's the case the runs above list as not tested, since their runs didn't reach it. On this machine main reaches the check and throws on every run.Setup: RTX 4070, Ryzen 7 7800X3D, 32 GB RAM, Windows 11, rustc 1.100.0 (MSVC), release build, XCL_NETWORK=0, XCL_PRESS_A_AT=20,25,30.
On main (3 runs): every run threw from XboxBvhBuilder.dll, with D3D12 XDXR Error: DestAccelerationStructureData can not have more than 40b of address set, right after index buffer at … (96 bytes) is outside unified memory … mirrored. The RAYTRACING_ACCELERATION_STRUCTURE addresses were above 2^40 (0x259919a0000, 0x2599375fb00, 0x1d294723500).
With this PR:
The RAYTRACING_ACCELERATION_STRUCTURE addresses are below 2^40: 0x1947a0000, 0x196562400, 0x1974fc000, 0x197d84800. Kept-in-step textures are also low (0x1128d06000, 0x12e222c000).
No XDXR Error. The same index buffer … (96 bytes) … mirrored line appears, then about 50 more translated compute PSOs, past the point where main threw.
The run then ends in the title's GPU watchdog (0xc0000005 in game_scarlett_master.exe+0x23cf683, write at 0x0), as in #505 / #534 and the RDNA4 runs above. Not related to this PR.
Not tested: smoke.ps1 regression runs, a debug build.
AI use: Claude helped read the logs and drafted this report. The builds and runs were done on my machine.
@anes66 on GitHub · 2026-11-24 04:15 UTC · original
Verified
12be9306269772e1e24aa1e44219f2bce684c193with MSVC on Windows 10 Pro (build 19045), Ryzen 7 9800X3D and RTX 3060 12 GB (driver 32.0.16.2114).Tested
cargo build --locked --workspace -j 4: passed.cargo test --locked --workspace --no-fail-fast -j 4 -- --test-threads=4 --show-output: 686 passed, 0 failed, 41 ignored. The new low_va test and synthetic title e2e tests passed.gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware. These are included in the passed count. All XCL_SAMPLE_* variables were unset, so sample-gated early returns do not establish coverage of game data.0x8140; mainf4ce27ceb6d1b0576d0c659b713b674778bf1968built here had0x8160. HIGH_ENTROPY_VA is cleared; DYNAMIC_BASE and NX_COMPAT remain set.0x1f9b6fc0000). With /HIGHENTROPYVA:NO: 0/20 were above it (first0x7fff0000). Reservations were released; no pages were committed.Not tested
Retail title smoke runs, XboxBvhBuilder progression, MEM_TOP_DOWN, release builds or GNU. The workspace run used this exact PR head, not a merge with current main. The standalone probe supports the allocation-placement explanation; it does not prove all title allocations will stay below 2^40.
AI use
Codex (GPT-6; exact variant unavailable) inspected the patch, ran the MSVC build and tests, wrote and ran the independent allocation probe, and drafted this report.
@maephisto666 on GitHub · 2026-11-24 08:59 UTC · original
Test report: MSVC toolchain, and a retail run of #585's crash with and without this change.
Rebase note. The PR no longer applies to
main(09940bb):maingained its owncrates/xcl/build.rsin #762 (translator source hash). I tested the PR's linker flag added tomain'sbuild.rs(inside itsmain(), after theXCL_TRANSLATOR_SOURCE_IDline), plustests/low_va.rsunchanged:Tested
x86_64-pc-windows-msvc, MSVC 14.44 link.exe.xcl.exeDllCharacteristics (release):main0x8160→ with the change0x8140(HIGH_ENTROPY_VA off, DYNAMIC_BASE still on).cargo build --workspacethencargo test --workspace -- --test-threads=4onmain+ the change (debug): 717 passed, 0 failed, 41 ignored;low_vapasses. SKIPPED:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64). Alsocargo test --release -p xcl --test low_va: 1 passed.XCL_NETWORK=0, fresh title data each run, 600 s cap, release builds:main09940bbxboxbvhbuilder.dllat0x1fb2ff00000/0x2e4d9bc0000; AS SRVs above 2^40main+ this changexboxbvhbuilder.dllat0x9e60000; AS SRVs at0x1947a0000–0x197d82e00With the change the BVH builder's 40-bit check no longer fires; the runs then stop at the #505 stall instead. The AS SRVs are still logged as "not in unified memory – writing empty BVH descriptor" (a separate gap, no crash).
Not tested: AMD GPUs, the GNU toolchain, other titles (Minecraft / XDefiant / Fortnite / Unicorn Overlord),
scripts/smoke.ps1blocks.AI use: Claude Code (Claude Opus 5.5) ran the builds, tests and retail runs on the hardware above and wrote this report.
@Creaa on GitHub · 2026-11-24 09:03 UTC · original
MSVC test on RTX 4070
RTX 4070 (driver 617.14), Core i7-13700F, Windows build 26300, Rust 1.100.0 (MSVC). Compared the PR head with its direct parent to isolate the linker change.
cargo test --locked --release -p xcl --test low_vaat the PR head: 1 passed, 0 failed, 0 ignored. PE DllCharacteristics was0x8160on the parent and0x8140on the PR head.scripts/smoke.ps1: 643 frames on the parent and 580 on the PR head. Both exited normally with zero crashes and zero device removals in that window. One comparable DirectStorage destination (#4096) moved from0x20b7465f6d4to0x18dfef6d4, below the 40-bit limit.+0x23cf683stopped the run at 218.382 s. That signature matches #846. Controllable gameplay was not reached. The parent was not run interactively for this comparison.Smoke blocks below have the title field redacted.
AI use: Codex (GPT-6) built the revisions, ran the tests and smoke trials, and drafted this report. The on-screen observations came from the user.
@AlexLopezDevelop on GitHub · 2026-11-24 09:50 UTC · original
Tested on RTX 2080 Ti (Turing, driver 621.24) + Intel i9-9900K, Windows 11, 32 GB, retail 1.0.2.1, merged onto #891 (
8cada26,XCL_PSO_WAIT_MS=50), DXC 1.9.2609, walked through the first-run setup by hand: #585 is gone.DestAccelerationStructureData can not have more than 40b of address set, C++ exception inxboxbvhbuilder.dll(https://github.com/ivall/xcl/pull/891#issuecomment-7127653308).xcl.exehasIMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VAcleared (DllCharacteristics0x8140against0x8160before), and the run went on to 633 s with 040b of address seterrors: 24,096 draws and 3,115 dispatches recorded, Opus audio decoding throughout.CreateShaderResourceView(RAYTRACING_ACCELERATION_STRUCTURE) at 0x19… is not in unified memory – writing empty BVH descriptor4 times, so the structures now sit below 2^40 but outside the unified windows.+0x23cf683), which on this machine looks like #582's write-watch cost, not this PR: details in #582.Merge note:
crates/xcl/build.rsconflicts withmain's translator-source hashmain(); I kept both bodies in onemain().AI-assisted (Claude Code, Claude Opus 5.5).
@ivall on GitHub · 2026-11-24 10:06 UTC · original
Merged as a port onto main's
build.rs(from #762) in02bfd1d, with the linker flag exactly as maephisto666 described and yourtests/low_va.rsunchanged (authored as you) - GitHub will not show this PR as merged, so I am closing it by hand. Thanks! Checked on main02bfd1dtogether with #891, #693, #551 and #631:cargo test --workspace -- --test-threads=4green (685 lib tests), and a retail run through the menus and intro into the start of the world load withXCL_PSO_WAIT_MS=50: no crash, no device removal.Pull request closed