LumaCore: multi-instance safe diversion artifact (fixes second Steam session under Duo isolation) - #148
Open
Jonybien wants to merge 1 commit into
Open
Conversation
…essions PrepareAndLoad() overwrote the fixed bin\lcoverlay.dll on every boot, so a second steam.exe (Duo Steam Isolation) died in CopyFileA with ERROR_SHARING_VIOLATION while the first session still had the module mapped. - diversion copy now lives at bin\lcoverlay-<sha16>.dll, published once and never rewritten while mapped; concurrent sessions share it read-only - atomic publication via per-pid temp + MoveFileExA; racing boots converge - stale artifacts and temp files swept by a deferred prune (attempt-based, safe against files other sessions keep mapped) - status.json gains a pid field plus a per-instance status.<pid>.json mirror; swap temp is per-process to stop cross-session races - [diversion] multiinstance setting (default on) with LUMACORE_MULTIINSTANCE env override for rollback without rebuilding Verified live with two simultaneous isolated sessions (both reach hooks_complete, 42 hooks each, shared artifact) plus a standalone unit test: published/reused-under-lock/corruption-recovery paths pass, sha256 matches the Windows CNG oracle.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With Duo Steam Isolation (multiple concurrent steam.exe from one install), LumaCore fails to initialize in the second session. Diversion::PrepareAndLoad() overwrites the fixed \bin\lcoverlay.dll on every boot; while session 1 keeps that module mapped, Windows rejects the overwrite with ERROR_SHARING_VIOLATION (32). The 25x120ms retry loop cannot outlast a mapped module, so boot aborts.
The global lumacore\status.json / status.json.tmp pair has the same single-instance assumption: sessions race on the same swap file and a healthy instance overwrites a failed instance's diagnostics.
Fix
Turns the diversion copy into an immutable, content-addressed artifact:
<Steam>\bin\lcoverlay-<first16-hex-of-sha256(steamclient64.dll)>.dlluntime/DiversionStore.{h,cpp} (streaming SHA-256 + protocol, self-contained).
Status side: "pid" field added, swap temps are now status.json..tmp, each instance also writes lumacore\status..json, and dead-session status files are pruned (throttled). SteaMidra keeps reading the global status.json unchanged.
SetBinarySnapshot() was previously never called; it is now wired so diversion_path/diversion_file_sha report real values.
Config / rollback
oml [diversion] multiinstance = true # default; false restores stock fixed-name behaviourEnvironment override without rebuilding: LUMACORE_MULTIINSTANCE=0|1.
Verification
--- status.<pid1>.json --- --- status.<pid2>.json --- startup_phase: hooks_complete startup_phase: hooks_complete diversion_strategy: content-addressed-multiinstance content-addressed-multiinstance diversion_path: bin\lcoverlay-86112382982fa855.dll (both)Closes the multi-instance failure mode described above. Happy to adjust naming/flag defaults if maintainers prefer a different contract.