xcl run: restore orig trampoline slot when RawDetour::enable fails #1568
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!1568
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1568"
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?
@b3IKK on GitHub · 2026-11-24 17:45 UTC · original
b3IKK:hooks/rollback-orig-on-enable-fail→main· +42 −3 · 1 files · 1 commits · openIn
hooks::hook,orig.store(d.trampoline() as *const () as usize, Ordering::Release)ran befored.enable()?. Ifd.enable()failed,RawDetourdropped and freed the trampoline memory whileorigretained the dangling trampoline address.CString::new(func).unwrap()also panicked on interior NUL bytes.This extracts
enable_detour()to restore the previousorigvalue on error, and returnsErrinstead of panicking on invalid function names.What is in it
crates/xcl/src/hooks.rs: addenable_detour()rollback on failure, replaceCString::new(func).unwrap()withmap_err, and add unit testsenable_detour_restores_orig_on_failure_and_keeps_it_on_successandhook_rejects_interior_nul_without_panicking.Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 778 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2no wave64—gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware; 1no heap windows—heap_window_out_of_memory_falls_back_to_the_switch_form)cargo test -p xcl --lib hooks::tests: 12 passed, 0 failed (includes the 2 newhooks::teststests)Regression run
main:
PR:
Not tested
AI use
hooks.rs, wrote the fix and unit tests, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.@futurepro62 on GitHub · 2026-11-24 18:53 UTC · original
Full-suite run, since this PR has no test report yet. Tested exact head
e33c721(on its base9e3831e).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form: 777 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.enable_detour_restores_orig_on_failure_and_keeps_it_on_success,hook_rejects_interior_nul_without_panicking.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 778 passed, 0 failed, 41 ignored. SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).heap_window_out_of_memory_falls_back_to_the_switch_formwas skipped with--skip. It fails on main9e3831etoo, not because of this PR: underXCL_REQUIRE_GPU=mesh,runner::skip_testturns every skip except "no wave64" into a failure, including this test's opt-in "no heap windows" skip (XCL_HEAP_WINDOWSunset). Reported as #1651.Not tested
AI use
@DavidM1911 on GitHub · 2026-11-24 19:41 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored.Thanks!
@upipibi on GitHub · 2026-11-26 16:08 UTC · original
NVIDIA test report for
e33c721: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug. Head tested as-is on its base9e3831e.cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4: 720 passed, 0 failed, 21 ignored; 2 SKIPPED (no wave64: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware), neither in a file this PR changes.hooks::tests::enable_detour_restores_orig_on_failure_and_keeps_it_on_successandhook_rejects_interior_nul_without_panicking, each with--exact --test-threads=1 --nocapture, 3 runs: 3/3 passed each, 0 SKIPPED.Lib tests only; no title run.
AI-assisted (Claude Code, Claude Opus 5.5).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.