victory-gpu(shadow): flush SNAPS before dropping Shadow to prevent use-after-free #935
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/936"
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 fxceless/victory-fork. Originally posted by faycalbaklouti on 2026-11-25T13:14:33Z.
Target upstream:
fxceless/victory-fork(note:SNAPS/VICTORY_WIDE_BACKis specific tofxceless/victory-forkand does not exist inMarvisak/VIctoryorBelobug/VIctory-Belobug-AMD)Problem
When
VICTORY_WIDE_BACK=1is enabled,Shadow::writingqueues raw pointer tuples(data_ptr, snapshot_ptr, len)into the globalSNAPSqueue for deferred parallel copying intake_snapshots(). If aShadowis dropped whileSNAPSstill holds pointers into its backing mapping or pooled snapshot buffer, the subsequenttake_snapshots()call reads/writes freed memory (use-after-free).Solution
impl Drop for Shadow, flush any queued entries inSNAPSviatake_snapshots()before releasing theShadow's resources.take_snapshots_flushes_queued_snaps_before_release.Verification
git apply --checkpasses cleanly onfxceless/victory-forkmain.About our fork & censorship-resistant preservation effort:
This fix comes from gta6-vi-port, our open-source Linux (GE-Proton) + NVIDIA RTX 4090 fork of VIctory and peer-to-peer Radicle archival effort (mirroring 92+ community porting repositories across public Radicle seeds so open-source porting research survives centralized takedowns; open-source code only, no game files/keys/binaries).
rad:z39ofPhQC1siudH9BF3xsmAMmUqxc).onionVP9+Opus viewer:http://kwnoaeecpmxd6eetqfa7fxlymvxnh5du2i6wxr44t4mc7cgch5pw23id.onion/)Imported from fxceless/victory-fork. Originally posted by tikD1337 on 2026-11-25T13:50:50Z.
Thanks for the fix. On
main@a253706(Windows 11, RTX 4070 Ti SUPER, Rust 1.98.1), the library builds, but the test target does not:The new test sits in
mod merge_tests, which only importsPIECE, back_piece, changed_runs. One line fixes it:With that line:
take_snapshots_flushes_queued_snaps_before_releasepasses, andcargo test --release -p victory-gpu --lib -- --test-threads=1gives 170 passed, 1 failed. The failure is the known flakyindirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fieldsthat #849 fixes.Imported from fxceless/victory-fork. Originally posted by faycalbaklouti on 2026-11-25T14:18:11Z.
Good catch, thanks for testing it! Added
use super::{give_back, pooled, take_snapshots, SNAPS};tomod merge_testsinc00ac40and verified thevictory-gpuWindows test target compiles cleanly (cargo xwin test --target x86_64-pc-windows-msvc -p victory-gpu --no-run).Imported from fxceless/victory-fork. Originally posted by faycalbaklouti on 2026-11-30T21:56:36Z.
The earlier missing-import fix and this lifetime fix are distinct. The revised
Shadow::writingfinishes the snapshot while it still holds both buffers; a flush inDropcannot wait for work another thread already removed from the queue. The regression now starts with four known bytes and checks their contents after a write; it passed in the workspace run. The cost of removing batching across declarations has not been measured.Compared
cda70978a8with368967f8feusing the target workflow’s two workspace Clippy builds and workspace tests. Both Clippy variants fail on the base precedence lint. Workspace tests execute and stop in the GPU unit suite with the same five failing assertions on both SHAs. This is baseline-identical on the Windows target under Wine, not a green native Windows run. The separate touched-package suite and each named head witness satisfy the package gate; clean-base zero matches are not passes.Radicle project hub (open-source porting and preservation history): https://radicle.network/nodes/rosa.radicle.network/rad:z3rqQw7796wMbgj8RszExtWR4wMSE
Live development stream: https://vdo.ninja/?view=gta6rtx4090live1080p60
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.