fix(linux): Harden directory iteration to prevent Wine/Proton crashes#1246
fix(linux): Harden directory iteration to prevent Wine/Proton crashes#1246500Byte wants to merge 3 commits into
Conversation
Added depth limit and explicit filtering of Wine virtual directories (dosdevices, drive_c, etc) to IterateGameDirectories to prevent BPModLoaderMod from hanging or crashing on Linux environments.
UE4SS
left a comment
There was a problem hiding this comment.
I don't like the idea of moving parts of BPModLoaderMod into core UE4SS.
This part of the PR should be removed.
I'm not happy with disallowing symlinks for paths.
It seems more like a workaround than an actual solution.
A better solution might be to check if the canonical path was already iterated.
That would allow the removal of the arbitrary depth limit of 7, and it would also avoid any hard-coded banned paths, while still allowing symlinks.
| ## Linux Stability Improvements | ||
|
|
||
| RE-UE4SS includes specific hardening for Linux/Proton environments to ensure a smooth experience: | ||
|
|
||
| - **Robust Directory Iteration:** Filesystem iterators now skip symbolic links and handle permission errors gracefully, preventing infinite recursion crashes (common with Wine's `Z:` drive mapping). | ||
| - **CPU Efficiency:** The async event loop and main update loop use thread-safe atomic flags and proper sleep intervals when paused, eliminating the 100% CPU busy-wait bug. | ||
| - **Thread-Safe Hooks:** Hook management uses a synchronized mutex system and safe data capture to prevent data races and Use-After-Free crashes during mod hot-reloading. | ||
| - **Improved UTF-8 Support:** Robust path conversion ensures that games installed in directories with non-ASCII characters (accents, CJK, etc.) load correctly. |
There was a problem hiding this comment.
This doesn't belong in the readme.
|
I don't have any other way of contacting you, so this will have to do. I know all three of your PRs have been created with AI, and that is provable by the existence of AI files in your repo, though you seem to have force pushed those files away. As with any work done by AI, my confidence is low, in both the code but also you as a contributor. Overall, the ideas for these PRs are mostly good, however, the implementations are not. |
What does this PR do?
Introduces stability improvements for users running RE-UE4SS under Linux via Wine/Proton, specifically fixing an infinite recursion crash during directory iteration.
The Problem
When running under Wine/Proton, the
Z:drive mapping (which maps the entire Linux root filesystem) can causestd::filesystem::directory_iteratorto fall into infinite recursion loops (by aggressively following symlinks or diving infinitely deep into restricted system directories), leading to a hard crash on startup.The Solution
iterate_directorylambda inLuaMod.cppby explicitly skipping symbolic links (item.is_symlink()).depth > 7) to completely prevent infinite iteration loops.LogicModspath resolution to avoid manually constructing directory paths that often fail under Linux filesystems.README.mdto accurately reflect the improved Linux/Proton stability status.