Memory: fix Arena::take alignment/overflow and Uma::free pool validation #1447
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!1447
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1447"
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 16:10 UTC · original
b3IKK:uma/arena-align-and-pool-free→main· +65 −8 · 1 files · 1 commits · openFixes three bugs in
crates/xcl/src/gpu/uma.rs:Arena::takereturnedGRAIN-aligned blocks even whenalign > GRAIN(violating the requested alignment), and computedalign.next_power_of_two(),self.at + align - 1, andat + nwithout overflow checks (panicking in debug or wrapping pastself.endin release).Uma::freepushed any address inside[pool.0, pool.1)onto the pool free list without verifyingARENA_BLOCKalignment or checking for duplicate frees, allowing interior pointers or double-frees to corrupt or alias subsequent arena allocations.Uma::reserve_pooloverwroteself.poolif called a second time, leaking the prior pool's reservation ininner.used.This routes
align > GRAINthroughu.alloc(n, align)and uses checked arithmetic inArena::take, validates block alignment and non-duplication inUma::free, and makesreserve_poola no-op once a pool is already reserved.What is in it
crates/xcl/src/gpu/uma.rs: fixArena::takealignment and overflow checks, validate pool frees inUma::free, guard repeatedreserve_pool, and add unit testsarena_take_enforces_large_alignment_and_checks_overflowandpool_free_rejects_interior_and_duplicate_pointers(both verified failing before the fix).Since the last push: rebased onto
main06c9f55. The conflict was the test module, wheremainhad addedruntime_layout_supports_eight_and_sixteen_heap_windows,expanded_heap_window_shaders_translate_and_validateandexpanded_runtime_layout_splits_large_coherent_heaps_across_multiple_windowsat the same place; all are kept. The first push of the rebase had a missing brace in the merged test module (test builds only, so the release smoke still ran);f3d3344fixes it, with the same non-test code.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): 1267 passed, 0 failed, 46 ignored (SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses,no heap windows, andcannot disable the driver cache (Windows Developer Mode is required))cargo test -p xcl --lib gpu::uma::tests: 9 passed, 0 failed (both new tests failed before the fix)Regression run
main (
426a5a7, clean tree, no local changes):PR (
f3d3344, clean tree, no local changes):(The main block is
426a5a7, an ancestor of the currentmain, from the same machine and data folder.)Not tested
AI use
main06c9f55, resolved the conflicts, ran the suite and thescripts/smoke.ps1pair at the head above.github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@futurepro62 on GitHub · 2026-11-24 16:54 UTC · original · edited 2026-11-24 17:03 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
f7b6286(on its baseb7aa9f3).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 772 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.arena_take_enforces_large_alignment_and_checks_overflow,pool_free_rejects_interior_and_duplicate_pointers.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 772 passed, 0 failed, 41 ignored, no skips.Not tested
AI use
@DavidM1911 on GitHub · 2026-11-24 18:52 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
@DavidM1911 on GitHub · 2026-11-26 05:27 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
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.