xmem: VirtualFree(MEM_DECOMMIT) keeps physical-page views, zeroes pool backing #126
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!126
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-126"
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?
@Olima34 on GitHub · 2026-11-26 17:39 UTC · original
Olima34:fix/xmem-decommit-pool-backed-zeroes→main· +150 −3 · 4 files · 1 commits · merged 2026-11-26 18:09 UTCSecond of the two xmem PRs you asked for on #15 (the first is #124). Small and tested, like #108.
Bug.
VirtualFree(MEM_DECOMMIT)over a range that shows physical-page views called a plain decommit. That put fresh anonymous pages in place of the pool's at the title address, whilePhysical.viewsand the GPU's pool table still showed the pool there. After a recommit the title wrote the anonymous pages, and the GPU and any alias read the pool's old bytes. That is the same class of CPU/GPU split as #108.Fix (
xmem_physical::decommit):mprotecton macOS, so the views come back read-write.XMemVirtualAlloc's pool backing (Pool.backs, set inback_with_pool) andshownlists a single address for it.map_alias) is still read there;XMemAllocatePhysicalPagespages outlive their mappings, since the title may map them again.map_aliasshows at another address. Single-address alone would wipe numbered pages the title can map again.Tests.
xmem_posix::decommitting_pool_backed_memory_zeroes_the_pool: write, decommit and recommit pool-backed memory. The title address and the GPU's pool both read 0, and later writes reach the GPU's pool. Fails on main ("the GPU's pool reads zeros too").host_posix::decommitting_keeps_pages_shown_at_other_addresses: a physical page mapped at two addresses, andXMemVirtualAllocmemory with amap_alias. After decommitting one address, the other still reads the bytes. It guards against zeroing too much: it fails if either condition is dropped.Known limit (
shortcut:comment). Zeroing touches every page it zeroes, including pages never written.cargo test -p victory-hle --target x86_64-apple-darwin --lib(247), Windows clippy andcargo xtask policypass. It merges cleanly with #124. Not checked in game.@LakshanSivakumar on GitHub · 2026-11-26 18:09 UTC · original
Merged, thanks. Views survive a decommit, and only lone pool backing is zeroed. Both x86_64 tests pass.