xcl run: guard null RIP in code_at and bounds-check GS hook target #1336
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1346"
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 ivall/xcl. Originally posted by b3IKK on 2026-11-24T15:03:49Z.
Three safety and bounds bugs in
crates/xcl/src/eh.rs:code_at(rip)calledstd::slice::from_raw_parts(rip as *const u8, 0)whenreadable()returnedfalse(includingrip == 0), which is UB for a null pointer even with length 0. It now returns an emptyStringwhenn == 0.find_gs_checkused an exclusive range0..code.len() - p.len() - 4, missing a pattern whose 4-byterel32ends at the last byte ofcode.hook_gs_failurepatched 12 bytes at the decodedE9 rel32target without checking whether[target, target + 12)stays within the supplied[at, at + len)section (or overflows).What is in it
crates/xcl/src/eh.rs: return early onn == 0incode_at, make the scan range inclusive infind_gs_check, bounds-check[target, target + 12)inside[at, at + len)inhook_gs_failure, and add unit testsfind_gs_check_matches_at_exact_end_of_buffer,hook_gs_failure_ignores_target_outside_section, andcode_at_handles_null_rip_without_ub(verified failing before the fix).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): 754 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)cargo test -p xcl --lib find_gs_check_matches_at_exact_end_of_buffer,hook_gs_failure_ignores_target_outside_section,code_at_handles_null_rip_without_ub: all pass (verified failing before the fix)Regression run
main:
PR:
Not tested
AI use
eh.rs, wrote the fixes and unit tests, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T15:17:52Z.
Full-suite run, since this PR has no test report yet. Tested exact head
e661e29(on its base930e8b4).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 754 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.find_gs_check_matches_at_exact_end_of_buffer,hook_gs_failure_ignores_target_outside_section,code_at_handles_null_rip_without_ub.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T16:17:54Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (One run showed a single flaky failure / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by S1m0ne1997 on 2026-11-25T14:53:09Z.
Test report for
e661e29383cc4207b9c4f4137d3a137aa020c0ea(this PR's head), for #1607.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09)x86_64-pc-windows-msvc, debug.cargo build --workspace, thencargo test --workspace -- --test-threads=4at the head: 754 passed, 0 failed, 41 ignored.gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64).Regression run (retail title,
scripts/smoke.ps1 -Seconds 60, release;mainbuilt from the commit in its block, this PR from its head with no changes tocrates/, both run with thescripts/smoke.ps1ofmain, which hashes the name of the game folder)main:
this PR:
Not tested
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.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T20:17:30Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:29:48Z.
Triage (#1607) – head
e661e29No open or merged PR makes these changes; main still has the off-by-one range in
find_gs_check, the uncheckedtargetinhook_gs_failureandfrom_raw_parts(null, 0)incode_at.hook_gs_failurenow requires__report_gsfailureto be inside the same executable section as__security_check_cookie(loader.rs calls it per section); an image with the two in different code sections would silently lose the hook. Three separate fixes in one PR.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.