xmem: 32-bit XMemFreeDefault frees without telling victory-gpu (title_memory_freed) #216
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX#216
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@kekonn on GitHub · 2026-11-26 11:55 UTC · original
What goes wrong
crates/victory-hle/src/modules/xmem.rs:369releases 32-bit allocations with the host'sVirtualFree(address, 0, MEM_RELEASE)directly.The allocation itself went through
XMemVirtualAlloc(~327-334), which callsvictory_gpu::title_memory_allocated(~180-182). The title's ownVirtualFreegoes throughtitle_virtual_free(~1986), which callsvictory_gpu::title_memory_freedfirst. Its doc (watch.rs~2656) says that without that call, guarded/clean/absent state noted for the range "would be taken for true of the next memory at the address". When the address is used again,title_memory_allocatedonly clearsheldblocks, soprotected/cleanbits stay set. A copy can then treat fresh, writable memory as clean and skip it.When
The default path, for
XMemFreeDefaultwithALLOC_32BITattributes. This is reached throughXMemFreeonly when the title exports no__XMemAllocationHooks__, or when its hook or middleware callsXMemFreeDefaultdirectly.Proposed fix (1 line)
Replace the call with the module's own
title_virtual_free(address, 0, MEM_RELEASE). With a length of 0,title_memory_freedfinds the allocation's end itself, a path thewatch.rstests already cover.Upstream: no open PR changes this. #142 lists
xmem.rs, but its copy is identical to main's.Status: a fix is being prepared in kekonn/VIctory-7900XTX on branch
claude/gifted-clarke-uxuqw8.Generated by Claude Code