Skip to content

Build: the high-entropy VA opt-out reaches only the xcl binary, so the 17 in-process integration tests run in the address space #631 removed #2263

Backlog

Description

@itsonewi

Summary

crates/xcl/build.rs (1a0bbe3) turns high-entropy VA off for one target:

Ok("msvc") => println!("cargo:rustc-link-arg-bin=xcl=/HIGHENTROPYVA:NO"),
Ok("gnu") => println!("cargo:rustc-link-arg-bin=xcl=-Wl,--disable-high-entropy-va"),

-bin=xcl is the [[bin]] xcl only. The crate also has a [lib], and 17 integration tests link that lib and drive the HLE in process:

pls_quota.rs  sparse_reinit.rs  texture_states.rs  gpu_compute_e2e.rs  predication_e2e.rs
d3d12_mesh_stream.rs  console_shaders.rs  xg_oracle.rs  gpu_pso_e2e.rs  d3d12_resource_and_sync.rs
console_dlls_e2e.rs  e2e.rs  heap_probe.rs  rpf_e2e.rs  disasm_e2e.rs  shaders_e2e.rs  launcher_e2e.rs

Those binaries are linked with Rust's default, so they keep high-entropy VA and their VirtualAlloc(NULL) reservations land around 1-2.5 TiB - the layout #631 measured and removed from xcl.exe:

default: first reservation at 0x1e1cb8a0000, 0x1eda2c40000 and 0x23344380000; 20/20 above 2^40 in every run
--disable-high-entropy-va: from 0x7fff0000 up; 0/20 above 2^40

(from #631's description)

Why it matters

heap_probe, sparse_reinit, pls_quota, predication_e2e and the rest run the HLE against an address space the released binary no longer has. Anything address-sensitive - the 2^40 ceiling in #585, the VirtualAlloc2 fallbacks @sub-north traced, heap-window and sparse reservations - is exercised at 2 TiB in cargo test and at 2 GiB in xcl.exe. In both directions that is wrong: a test can pass over a path the exe cannot take, and can fail on a layout the exe cannot reach.

crates/xcl/tests/low_va.rs does not cover this: it reads env!("CARGO_BIN_EXE_xcl") (the binary's PE DllCharacteristics), so the process it runs in is still high-entropy VA.

Suggested fix

Ok("msvc") => {
    println!("cargo:rustc-link-arg-bin=xcl=/HIGHENTROPYVA:NO");
    println!("cargo:rustc-link-arg-tests=/HIGHENTROPYVA:NO");
}
Ok("gnu") => {
    println!("cargo:rustc-link-arg-bin=xcl=-Wl,--disable-high-entropy-va");
    println!("cargo:rustc-link-arg-tests=-Wl,--disable-high-entropy-va");
}

rustc-link-arg-tests applies to every integration-test binary of the package. The binary keeps its own directive, and the PE-header test keeps guarding it, so the two cannot drift apart silently. If the tests are meant to run in the default layout on purpose, then what is missing is a note saying so: as it stands the difference is invisible from the test side.

A cheap check after the change: a test that calls VirtualAlloc(NULL) once and asserts the returned address is below 2^40 - it fails on main today.

Not tested

AI use

  • Claude (Opus 5.5) read crates/xcl/build.rs, crates/xcl/tests/low_va.rs and the list of tests that import the crate, and wrote this report; the human account checked each file before opening it.

Activity

  1. Decodere commented on Nov 25, 2026

    @Decodere
    Contributor

    Taking #2263 in crates/xcl/build.rs and crates/xcl/tests/low_va.rs.

    Plan:

    • Emit cargo:rustc-link-arg-tests=/HIGHENTROPYVA:NO (MSVC) and cargo:rustc-link-arg-tests=-Wl,--disable-high-entropy-va (GNU) alongside the existing rustc-link-arg-bin=xcl directives in crates/xcl/build.rs.
    • Extend crates/xcl/tests/low_va.rs to check DllCharacteristics & HIGH_ENTROPY_VA == 0 on std::env::current_exe() as well as xcl.exe, plus verify a live VirtualAlloc(NULL, 64 KiB, MEM_RESERVE, PAGE_READWRITE) (freed with VirtualFree) lands below 1 << 40.
    • Verify failing-first on main, post-fix low_va pass, full cargo test --release --workspace across all 17 integration-test binaries under the low-VA layout, and pr_check.py.

    AI use: drafted with Google Antigravity (Gemini 4 Neon); implementation and tests will run locally.

  2. Lum7nt commented on Nov 25, 2026

    @Lum7nt
    Contributor

    Verified PR #2292 (\5a26eb9) on Windows 11 (NT \10.0.22631.0),
    ustc 1.100.0\ MSVC, RTX 3060 (\XCL_ADAPTER=nvidia, debug profile):

    • \cargo test -p xcl --test low_va -- --nocapture: 2 passed, 0 failed, 0 ignored (\integration_tests_are_linked_without_high_entropy_va\ and \xcl_exe_is_linked_without_high_entropy_va).
    • \cargo test --workspace --no-fail-fast -- --test-threads=4: 1249 passed, 2 failed, 46 ignored (the 2 failures are pre-existing \GetCachedBlob()\ failures on this driver/setup, also present on \origin/main\ \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions