fix(vk): the game no longer crashes where Streamline's plugins cannot resolve their folders in the sandbox #3131
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3131
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:fix/sl-folder-check"
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?
Summary
On at least one Windows PC (nightly-1045, RTX 4060), turning on DLSS Frame Generation made the game crash with
0xc0000005at every start, since the setting is saved.Each Streamline plugin, as it loads, calls
std::filesystem::weakly_canonicalon its own folder and on NVIDIA's models folder. On that PC the sandboxed game is refused (weakly_canonical: Access is denied.: "...\builds\default\"). The plugin swallows the error and reports success half set up, the plugin manager trips on the missing data, and the game faults. Since #3068 Streamline really starts in the sandbox, so this became reachable. It needs the sandbox on: since #3132 the sandbox is off by default, so on currentmainonly a run withHOS_SANDBOX=1orstrictshould be affected.To see it on
main: that PC, a Windows build with Streamline's files,HOS_SANDBOX=1in the real environment, Frame generation at Fixed by DLSS FG, "DLSS FG through" at Streamline, then start the game. No other PC is known to show it.This change stops the crash; it does not make Streamline work on that PC:
sl.interposer.dllis loaded,folder_resolvesmakes the same two calls on both folders (CreateFile2, thenGetFinalPathNameByHandleW), and on a missing folder's parents, asweakly_canonicaldoes. If Windows refuses one, the log names it with the error, Streamline is not loaded, and the run goes on as without it.sl.*.dll) by the builder's file service is now logged. It was taken for the game's own module and left out.Which of the two calls is refused is not known yet. The log line from that PC decides the fix for the cause, so this says "See", not "Fixes".
See #3109.
Read first:
folder_resolvesanddlssg_loadingpu/vk/vk_dlssg.cpp,askerinhost/hos_file_windows.c.Testing
Tested: nothing has run in the game. The change is Windows-only and the PC it was written on is Linux.
tests/test_dlssg_folders.py(new, g++ and clang++, stand-ins for the Windows calls): the check on a made-up tree of folders (refused parents of a missing folder, a 4000-character name), anddlssg_load's own lines from the check to the load (no load after a refusal). Fails onmain(no check before the load), passes here.tests/test_sandbox_refusals_wine.py(Wine, llvm-mingw): the newsl.test.dllcase fails without theaskerchange, passes with it.tests/test_builder_files_wine.py,tests/test_sandbox_program_data_wine.py,tests/test_dlssg.py,tests/test_doc_anchors.py: pass.-fsyntax-only -Wall -Wextra:gpu/vk/vk_dlssg.cpp(with Streamline's headers) andhost/hos_file_windows.c: no errors. Not a game build.mise run lintpasses on the head.mise run test: 876 passed, 3 failed, 12 skipped, on an earlier head and base: not rerun since the rebase onto the currentmainor the review fixes (after them:test_dlssg_folders.py,test_dlssg.py,test_doc_anchors.py,test_sandbox_refusals_wine.py,test_builder_files_wine.pyand the renderer's syntax check pass). The three failures come from files this PR doesn't change, and were not run onmain:test_utf8_paths.py:CP_ACPinnote_load_ansi(host/hos_file_windows.c, the line is onmain).test_run_all_junit.py: its inner run fails.test_lifter.py: rustfmt and clippy inbuilder/crates/build-core/src/addons.rs, and anffi-gentest.Still to test:
HOS_SANDBOX=1, Streamline chosen: expect no crash, avk: Streamline: ... (CreateFile2 or GetFinalPathNameByHandleW, error N)line, thennot started, and DLSS FG through NGX (by hand, the reporter)HOS_SANDBOX=1and again unset: expectStreamline startedas onmain, no refusal line. This is the main risk (by hand or Test Farm)main(Test Farm or by hand)Measurements
Nothing to measure: two file-system calls per folder, once at the start, and only where Streamline would start.
Risks
ProgramDatavariable (Streamline asksSHGetKnownFolderPath; normally the same). Streamline's staging models folder (an NVIDIA registry setting) is not checked.RX_VK_DLSSG=0, or on a build with #3132, the sandbox left off.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (Three failures, in files unchanged here; not rerun onmain)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Possibly related, for context:
@review
Recommendation: Request changes. The folder check can let Streamline load even when resolving an existing parent of a missing models folder would fail, leaving a crash path open. The new test also does not verify that a failed check prevents loading.
The change probes Streamline’s folders before loading it and logs sandbox refusals from its DLLs. It could avoid the reported startup crash, but the probe does not yet cover the parent-directory walk and its behavior has not been verified in the game.
Blocking (1): must change before merging.
gpu/vk/vk_dlssg.cpp:386: A missing folder is accepted without checking the existing parent that weakly_canonical will resolve. (more on the line) Do: Walk back to the first existing parent and check its final path, matching weakly_canonical’s handling of missing components; add a test for a missing leaf with an inaccessible parent.Should fix (2): not blocking, but worth doing before merging.
tests/test_dlssg_folders.py:111: The test checks for the probe’s text before LoadLibraryW but does not test that a failed probe stops the load. (more on the line) Do: Exercise the load decision with stand-ins and assert that neither refusal reaches LoadLibraryW, while successful checks do.gpu/vk/vk_dlssg.cpp:378: The fixed UTF-8 buffer can leave the folder name empty in the refusal log. (more on the line) Do: Size the UTF-8 string from WideCharToMultiByte’s required length and handle conversion failure explicitly.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_dlssg.cpp:450: The reported crash and the fallback remain unverified on the affected PC. (more on the line) Do: Reproduce on the reported Windows RTX 4060 with the sandbox and saved Streamline settings, then run this change and record the log and whether startup succeeds.gpu/vk/vk_dlssg.cpp:450: The probe’s effect on a working Streamline installation has not been checked in the game. (more on the line) Do: Run on a working Windows RTX 40 or 50 Streamline setup with the sandbox enabled and disabled, and record startup and frame-generation behavior.@fixcan do L1, L2 and L3.Questions (1) (not confirmed from the code; they don't hold the recommendation)
Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven. The PR reports game-free tests but no game run on either the affected PC or a working Streamline setup; the refused call on the affected PC is not yet known.
Other systems: The new probe runs only in Windows builds with Streamline selected and an NVIDIA adapter. It can disable Streamline on otherwise working systems; Linux’s renderer path is unchanged. The sandbox logging change affects Windows DLL refusals.
Switches: No switches added, changed or removed.
Reviewed:
41982b409cagainstca5d307814: Read the repository rules, PR template, diff and commits, changed tests, and the relevant renderer and Windows file-hook code. Skimmed the changed reference documentation and surrounding call sites; the complete renderer and host files were not read in full. Tooling’s AGENTS.md was unavailable in the checkout.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run, as requested. The PR reports game-free checks and syntax checks, but no in-game run; CI was still running.
Overlaps and merge order: PR #3132 changes the sandbox default and is reported merged after this branch’s base; the affected path must be tested with the sandbox explicitly enabled.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -367,0 +375,4 @@e == ERROR_BAD_PATHNAME || e == ERROR_DIRECTORY || e == ERROR_NETNAME_DELETED;};char name[3072] = ""; // (the log's strings are UTF-8)WideCharToMultiByte(CP_UTF8, 0, folder, -1, name, (int)sizeof name - 1, nullptr, nullptr);L3 (should fix): The fixed UTF-8 buffer can leave the folder name empty in the refusal log.
When: For a supported long path whose UTF-8 encoding needs more than the buffer, WideCharToMultiByte fails and name remains empty, so the diagnostic does not identify the refused folder.
Do: Size the UTF-8 string from WideCharToMultiByte’s required length and handle conversion failure explicitly.
@ -367,0 +383,4 @@OPEN_EXISTING, &x);if (h == INVALID_HANDLE_VALUE) {const DWORD e = GetLastError();if (not_there(e)) return true;L1 (blocking): A missing folder is accepted without checking the existing parent that weakly_canonical will resolve.
When: If NVIDIA’s models folder does not exist but an existing parent cannot be canonicalized in the sandbox, the initial open returns a not-found error and this returns true. Streamline then walks to that parent and can encounter the same exception and crash this check is meant to prevent.
Do: Walk back to the first existing parent and check its final path, matching weakly_canonical’s handling of missing components; add a test for a missing leaf with an inaccessible parent.
@ -414,0 +447,4 @@// (what each plugin resolves as it loads, asked first: a refusal inside one takes the game down (folder_resolves))const wchar_t* const program_data = _wgetenv(L"ProgramData");const std::wstring models = program_data ? std::wstring(program_data) + L"\\NVIDIA\\NGX\\models" : std::wstring();if (!folder_resolves(s.dir.c_str()) || (!models.empty() && !folder_resolves(models.c_str()))) {L4 (should fix): The reported crash and the fallback remain unverified on the affected PC.
When: If the refusal occurs in a call or folder the probe does not reproduce, the probe passes and Streamline still crashes at startup.
Do: Reproduce on the reported Windows RTX 4060 with the sandbox and saved Streamline settings, then run this change and record the log and whether startup succeeds.
L5 (should fix): The probe’s effect on a working Streamline installation has not been checked in the game.
When: A refusal from the new probe disables Streamline for the entire run, including on a system where the plugin would otherwise start.
Do: Run on a working Windows RTX 40 or 50 Streamline setup with the sandbox enabled and disabled, and record startup and frame-generation behavior.
@ -0,0 +108,4 @@a = ap.parse_args()source = (ROOT / "gpu" / "vk" / "vk_dlssg.cpp").read_text(encoding="utf-8")load = block(source, "PFN_vkGetInstanceProcAddr dlssg_load() {\n State& s = st();")at = [load.find(m) for m in ("!folder_resolves(s.dir.c_str())", "LoadLibraryW(path.c_str())")]L2 (should fix): The test checks for the probe’s text before LoadLibraryW but does not test that a failed probe stops the load.
When: Removing the return from the refusal branch leaves both searched strings in the same order, and the extracted folder_resolves tests still pass, although the game loads Streamline after a refusal.
Do: Exercise the load decision with stand-ins and assert that neither refusal reaches LoadLibraryW, while successful checks do.
41982b409c6d2741262fBeanBot's review, fixed in
6d2741262f(rebased onto currentmain):weakly_canonicaldoes. Tested with a refused open and a refused final path on a parent.dlssg_load's own lines from the check toLoadLibraryWand asserts that neither refusal reaches it.WideCharToMultiByte, and now comes last in the line, since a log line is cut at 1024 bytes. The call and the error stay.SHGetKnownFolderPath(FOLDERID_ProgramData)(sl.ota/ota.cpp); this reads theProgramDatavariable, normally the same. Not changed. Streamline's staging folder, chosen by an NVIDIA registry setting, is not checked. Both are in Risks.@review
WIP: fix(vk): the game no longer crashes where Streamline's plugins cannot resolve their folders in the sandboxto fix(vk): the game no longer crashes where Streamline's plugins cannot resolve their folders in the sandboxRecommendation: Approve. The code is ready: only testing is left. The probe and its fallback have not yet been verified in the game on either the affected PC or a working Streamline installation. The recorded game-free checks support the implementation, but do not establish that it prevents the reported crash. Recommend approval; not approved on the forge.
Before loading Streamline, the change probes its plugin and models folders and falls back to NGX if resolution is refused. It also logs refusals from Streamline DLLs; the cost is extra startup file operations and a risk of disabling Streamline where it would otherwise work.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_dlssg.cpp:450: The reported crash and the fallback remain unverified on the affected PC. When: If the refusal occurs in a call or folder the probe does not reproduce, the probe passes and Streamline still crashes at startup. Do: Reproduce on the reported Windows RTX 4060 with the sandbox and saved Streamline settings, then run this change and record the log and whether startup succeeds.gpu/vk/vk_dlssg.cpp:450: The probe’s effect on a working Streamline installation has not been checked in the game. When: A refusal from the new probe disables Streamline for the entire run, including on a system where the plugin would otherwise start. Do: Run on a working Windows RTX 40 or 50 Streamline setup with the sandbox enabled and disabled, and record startup and frame-generation behavior.Since the last review (on
41982b409c)Resolved: L1 (A missing folder is accepted without checking the existing parent that weakly_canonical wi…); L2 (The test checks for the probe’s text before LoadLibraryW but does not test that a failed p…); L3 (The fixed UTF-8 buffer can leave the folder name empty in the refusal log.)
Still open: L4 (The reported crash and the fallback remain unverified on the affected PC.); L5 (The probe’s effect on a working Streamline installation has not been checked in the game.)
Checks: Still running: 11 checks.
Also noticed (2; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Unproven: no game run has confirmed that the probe catches the reported refusal or that the fallback prevents the crash. The description reports passing game-free stand-in tests, but no in-game results.
Other systems: The probe runs only in the Windows Streamline build and can affect working NVIDIA installations by preventing Streamline from starting. Linux does not execute it; the host logging change affects Windows sandbox refusal reporting. Neither platform has a recorded in-game run for this change.
Switches: None added, changed or removed.
Reviewed:
6d2741262fagainst067e83629b: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the full diff, the new folder test and the changed code around the probe and sandbox logging. The full output of the renderer and host files was truncated; the remaining code, referenced standards and existing Wine test were not read in full. Recorded test claims were skimmed.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run the project were executed. The pull request reports passing game-free tests and Windows syntax checks; affected-PC and working-Streamline game runs remain outstanding.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
Recommendation: Approve. The code is ready: only testing is left. The folder probe and fallback have not yet been verified on the affected PC, and a working Streamline installation has not been checked for false refusals. Recommend approval; not approved on the forge.
The change checks Streamline’s plugin and model folders before loading it, falls back when access is refused, and logs refusals from Streamline DLLs. It adds a small startup check and may disable Streamline where the probe incorrectly reports a refusal.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_dlssg.cpp:450: The reported crash and the fallback remain unverified on the affected PC. When: If the refusal occurs in a call or folder the probe does not reproduce, the probe passes and Streamline still crashes at startup. Do: Reproduce on the reported Windows RTX 4060 with the sandbox and saved Streamline settings, then run this change and record the log and whether startup succeeds.gpu/vk/vk_dlssg.cpp:450: The probe’s effect on a working Streamline installation has not been checked in the game. When: A refusal from the new probe disables Streamline for the entire run, including on a system where the plugin would otherwise start. Do: Run on a working Windows RTX 40 or 50 Streamline setup with the sandbox enabled and disabled, and record startup and frame-generation behavior.Since the last review (on
6d2741262f)Still open: L4 (The reported crash and the fallback remain unverified on the affected PC.); L5 (The probe’s effect on a working Streamline installation has not been checked in the game.)
Checks: Still running: 11 checks.
Also noticed (4; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Unproven: the reported crash and fallback have not been tested in the game on the affected PC. The reported game-free tests use stand-ins and Wine.
Other systems: The probe runs on Windows when Streamline would start; a false refusal can route DLSS frame generation through NGX. Linux excludes the Streamline implementation. A working NVIDIA installation and the affected sandboxed PC still need game runs.
Switches: None added, changed or removed.
Reviewed:
6d2741262fagainst067e83629b: Read the repository rules, PR template, commits and diff; inspected the folder probe, load path, refusal logging and test changes. The large changed code and reference files were only partly visible in the captured output. Tooling’s AGENTS.md was unavailable; docs/review-checklist.md does not exist.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run project code were executed. The author reports game-free checks and Windows syntax checks passing; no game run has been reported.
Overlaps and merge order: none found
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as HumanBean took it out of WIP. Nothing was run; a maintainer decides.