Skip to content

Build: opt integration tests out of high-entropy VA alongside xcl.exe - #2292

Open
Decodere wants to merge 1 commit into
xcl-dev:mainfrom
Decodere:fix-2263-low-va-tests
Open

Decodere wants to merge 1 commit into
xcl-dev:mainfrom
Decodere:fix-2263-low-va-tests

Conversation

@Decodere

Copy link
Copy Markdown
Contributor

What is in it

Fixes #2263.

crates/xcl/build.rs previously emitted cargo:rustc-link-arg-bin=xcl=... only, leaving the crate's integration test binaries linked with Windows high-entropy ASLR (where VirtualAlloc(NULL) lands above 2^40 instead of matching xcl.exe's low-VA layout from #631).

  • crates/xcl/build.rs: also emit cargo:rustc-link-arg-tests=/HIGHENTROPYVA:NO (MSVC) and cargo:rustc-link-arg-tests=-Wl,--disable-high-entropy-va (GNU) alongside the existing cargo:rustc-link-arg-bin=xcl directives.
  • crates/xcl/tests/low_va.rs: share assert_no_high_entropy_va(&Path) between xcl_exe_is_linked_without_high_entropy_va and a new integration_tests_are_linked_without_high_entropy_va test that checks both std::env::current_exe()'s PE DllCharacteristics & IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA == 0 and a live VirtualAlloc(NULL, 64 KiB, MEM_RESERVE, PAGE_READWRITE) (freed with VirtualFree) landing strictly below 1usize << 40.

Tested

  • Hardware / toolchain: NVIDIA GeForce RTX 4060 (8 GB, 32-lane waves, driver 621.14), Intel Core i5-11400F, 32 GB RAM, Windows 11 Home build 26200, Rust 1.100.0 (MSVC), DXC 1.9.2609.5 (01b62ad4), debug and release builds.
  • Failing-first verification before the build.rs change: cargo test --release -p xcl --test low_va -- --nocapture failed integration_tests_are_linked_without_high_entropy_va (1 passed, 1 failed: DllCharacteristics 0x8160: high-entropy VA is on).
  • Post-fix targeted test (cargo test --release -p xcl --test low_va -- --nocapture and cargo test -j 4 -p xcl --test low_va -- --nocapture): 2 passed, 0 failed, 0 ignored in both release (0.00 s) and debug (0.01 s).
  • Full workspace release build and test suite (cargo build --release --workspace and cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture): 23 test binaries, 1251 passed, 0 failed, 46 ignored (all in-process integration test binaries built and passed under the low-VA layout), plus 27 runtime SKIPPED lines (20 no wave64 on RTX 4060, 3 wave32 per-lane form refused by driver, 2 missing d3d12SDKLayers.dll / D3D12 debug layer, 1 driver shader cache toggle unavailable, 1 no heap windows).

Regression run

Baseline (origin/main 1a0bbe3a):

xcl-smoke v1
commit: 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1553 (PresentX 1554)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14428 MB

PR head (5a26eb9d):

xcl-smoke v1
commit: 5a26eb9db5516e8bdcd133140d993ec89a79a256
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1570 (PresentX 1570)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14408 MB

Not tested

  • MinGW / x86_64-pc-windows-gnu toolchain (-Wl,--disable-high-entropy-va mirrors the existing xcl.exe directive in build.rs, tested here on x86_64-pc-windows-msvc).
  • AMD and Intel GPUs, native wave64 hardware, the 27 runtime-skipped GPU/driver tests, and the 46 #[ignore] tests on this machine.

AI use

Implemented and verified with Google Antigravity (Gemini 4 Neon). All build-script and test changes, failing-first and post-fix runs, full workspace release tests, and paired 60 s RTX 4060 smoke runs were reviewed and executed locally.

`crates/xcl/build.rs` previously emitted `cargo:rustc-link-arg-bin=xcl=...`
only, leaving the crate's integration test binaries linked with Windows
high-entropy ASLR (where `VirtualAlloc(NULL)` lands above 2^40 instead of
matching `xcl.exe`'s low-VA layout from xcl-dev#631).

Also emit `cargo:rustc-link-arg-tests=/HIGHENTROPYVA:NO` (MSVC) and
`cargo:rustc-link-arg-tests=-Wl,--disable-high-entropy-va` (GNU) in
`crates/xcl/build.rs`, and extend `crates/xcl/tests/low_va.rs` to verify
both `xcl.exe` and the integration-test executable clear
`IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA` and reserve `VirtualAlloc(NULL)`
strictly below 2^40.

Fixes xcl-dev#2263
Assisted-by: Google Antigravity (Gemini 4 Neon)
@Lum7nt

Lum7nt commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Tested on \5a26eb9db5516e8bdcd133140d993ec89a79a256\ (\5a26eb9, clean PR head):

  • Hardware / OS / Toolchain: NVIDIA GeForce RTX 3060 12 GB (driver \32.0.15.8142\ / 581.42, wave32), Intel Core i5-10400, Windows 11 (NT \10.0.22631.0),
    ustc 1.100.0\ (\x86_64-pc-windows-msvc), DXC \1.8.2502.11\ (Windows SDK \10.0.26100.0), debug profile, \XCL_ADAPTER=nvidia.
  • Focused run (\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\ both pass).
  • Workspace suite (\cargo build --workspace\ then \cargo test --workspace --no-fail-fast -- --test-threads=4): 1249 passed, 2 failed, 46 ignored (1180 lib + 69 integration; \origin/main\ \

@S1m0ne1997

Copy link
Copy Markdown

Test report for 5a26eb9db5516e8bdcd133140d993ec89a79a256 (this PR's head), for #1607.

Tested

  • NVIDIA GeForce RTX 4090 24 GB (driver 621.40), AMD Ryzen 9 9950X3D, 47 GB RAM, Windows 11 Home 10.0.26300, rustc 1.100.0 (0ef1bc386 2026-11-09) x86_64-pc-windows-msvc, debug.
  • cargo build --workspace, then cargo test --workspace -- --test-threads=4 at the head: 1251 passed, 0 failed, 46 ignored.
  • SKIPPED (17): a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu (no wave64), coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu (no wave64), cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu (no wave64), the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu (no wave64), a_per_lane_2d_or_3d_group_runs_on_the_gpu (no wave64), const_and_null_mask_operands_agree_with_hlsl_on_the_gpu (const_mask, wave64: no wave64), f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's)); f16 arithmetic, wave64: no wave64), f32_programs_on_the_gpu (f32 arithmetic, wave64: no wave64; f32 compares, wave64: no wave64), f64_programs_on_the_gpu (f64, wave64: no wave64), integer_programs_on_the_gpu (integer arithmetic, wave64: no wave64; integer carries, wave64: no wave64), mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu (mask_ff0_flbit, wave64: no wave64), gpu_geometry_wave32_prefix_count_over_a_mask (no wave64), gpu_wave32_program_in_wave64_hardware (no wave64), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows), pso_measurement_compiles_an_exact_synthetic_record (cannot disable the driver cache (Windows Developer Mode is required): L'applicazione ha richiesto un'operazione che dipende da un componente SDK mancante o non corrispondente. (0x887A002D)), test_title_draws_with_a_root_signature_under_the_debug_layer (no d3d12SDKLayers.dll), uploads_start_from_each_subresources_state (no D3D12 debug layer (L'applicazione ha richiesto un'operazione che dipende da un componente SDK mancante o non corrispondente. (0x887A002D))).

Not tested

  • No smoke pair: the PR changes no runtime code (crates/xcl/build.rs, crates/xcl/tests/low_va.rs).
  • AMD, other NVIDIA cards and drivers, Linux. I did not review the diff; this report is the build, the suite and the regression run only.

AI use: Claude Code with Claude Opus 5.5 ran the build, the suite and the regression run and wrote this report at my request.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

@raylitebull

Copy link
Copy Markdown
Member

Code review on 5a26eb9 (crates/xcl/build.rs): clean extension of /HIGHENTROPYVA:NO / -Wl,--disable-high-entropy-va via cargo:rustc-link-arg-tests alongside cargo:rustc-link-arg-bin=xcl, and CI is green.

Remaining before merge: An AMD verification pass on 5a26eb9 (NVIDIA RTX 3060 / 3060 Ti passed).

@wanchudao

Copy link
Copy Markdown

Tested

Tested 5a26eb9db5516e8bdcd133140d993ec89a79a256 from clean checkouts on Windows 11 Pro build 26300, Rust/Cargo 1.100.0, MSVC 14.44.35207, Windows SDK 10.0.26100, and RTX 3070 Ti (driver 610.88).

  • MinGW — cargo test --locked --target x86_64-pc-windows-gnu -p xcl --test low_va -- --nocapture passed 2/2 with WinLibs GCC 16.2.0 and GNU ld 2.47.20260726. The low_va executable and regular xcl.exe both had DllCharacteristics = 0x0140. This run covered the low_va integration target.
  • MSVC — cargo test -p xcl --test low_va -- --nocapture and cargo test --locked --release -p xcl --test low_va -- --nocapture each passed 2/2. Both profiles produced 0x8140 for low_va and xcl.exe. A debug artifact audit with cargo test -p xcl --no-run --message-format=json found 0x8140 on all 19 integration executables and the xcl bin test harness.
  • Failing-first — The MSVC debug command on the PR base 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6 with only the updated low_va.rs gave 1 passed, 1 failed, and exit 101. The new test failed on the 0x8160 PE header before reaching its allocation check.
  • MSVC debug workspace — Ran cargo build --workspace and then cargo test --workspace --no-fail-fast -- --test-threads=4. Cargo reported 1251 passed, 0 failed, and 46 ignored. There were 27 SKIPPED lines across 17 test labels.

The debug lib unit-test harness was the only test executable with 0x8160. Cargo's rustc-link-arg-tests applies to integration targets. In a separate MSVC probe, the lib harness kept 0x8160 and one reservation landed above 2^40. A package-wide link directive cleared the bit on all three probe harnesses. The integration-test scope in #2263 is covered by this PR on MSVC debug. Matching the lib harness to the executable's layout would be separate work.

Not tested

The release workspace suite and release lib harness, the other 18 GNU integration targets, AMD/Intel, and retail-title or external sample paths. The ignored tests and the skipped branches above are outside the measured coverage.

AI use

DeepSeek Harness (DS V4.1 FLASH) ran the initial tests. Codex desktop (GPT-6.2 SOL) independently reran the tests, audited the PE headers, and drafted this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

off-goal Does not bear on the current goal (world loading); waits until it is reached

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

7 participants