HLE: retain DirectStorage file references across queued reads #2441
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!2441
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2441"
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?
@fuzeofficlal on GitHub · 2026-11-29 13:04 UTC · original
fuzeofficlal:fix/hle-dstorage-retain-file-ref→main· +150 −34 · 1 files · 1 commits · merged 2026-11-30 14:12 UTCProblem
enqueue_requestincrates/victory-hle/src/modules/dstorage.rscopied the rawRequeststruct (including itssourcefile pointer) without retaining a reference onInstance<File>. Unlikeenqueue_status(which callsadd_ref_instanceand releases onStatus::drop), if a title released its final reference to a file object after enqueueing/submitting a read,release::<File>dropped theInstance<File>and closed the underlying host file handles while the request was still queued or running, causing the worker thread to dereference freed memory inread_into,source_path, orErrorRecord::of.Fix
CopyHeldFile(Option<NonNull<Instance<File>>>)owned byReadand moved intoJob:add_ref_instanceon enqueue for file-backed non-null requests (options & MEMORY_SOURCE == 0).releaseinDropwhen the request completes, is rejected by a closed queue, or is discarded when the lane closes.Jobby value intoLanes::finish, construct anyErrorRecordwhilefileis still alive, and dropfilebefore callinglane.failed/lane.flush()so the host file handles are guaranteed closed before completion or error events are published to the title.request.sourceinread_into(returningErr(E_INVALIDARG)).Verification
modules::dstorage::tests(queued_reads_keep_the_file_open_until_completion,closing_a_queue_releases_unsubmitted_file_reads,read_into_rejects_a_null_source).VIctory-NVIDIA:cargo test --locked -p victory-hle --lib modules::dstorage::tests -- --test-threads=1cargo test --locked -p victory-hle -- --test-threads=1cargo clippy --locked -p victory-hle --all-targets(no new warnings)cargo run --quiet --locked -p xtask -- policy --staged@Dukestar69 on GitHub · 2026-11-29 13:25 UTC · original · approved these changes
Tested locally merged onto
main(829188e9).crates/victory-hle/src/modules/dstorage.rs.cargo test -p victory-hle --lib dstoragepassed (32 passed; 0 failed; 2 ignored, including the newqueued_reads_keep_the_file_open_until_completionandclosing_a_queue_releases_unsubmitted_file_readstests) with 0 warnings invictory-hle.Important lifetime fix preventing use-after-release of DirectStorage file handles across queued reads. LGTM.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).