mirror of
https://github.com/games-on-whales/wolf.git
synced 2026-10-15 13:02:03 +00:00
[PR #493] fix(hardware): own DRM descriptors by value #495
Labels
No labels
🧠 1 - 🤖 999
AMD
bug
bug
cannot reproduce
documentation
duplicate
easy
enhancement
enhancement
enhancement
fixed?
fixed?
good first issue
hard
help wanted
Intel
invalid
LXC
medium
moonlight-protocol
Multi GPU
nixos
not a bug
nvidia
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
games-on-whales/wolf#495
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/games-on-whales/wolf/pull/493
Author: @elibosley
Created: 8/29/2026
Status: 🔄 Open
Base:
beta← Head:fix/drm-device-descriptor-ownership📝 Commits (1)
b565cfffix(hardware): own DRM descriptors by value📊 Changes
4 files changed (+123 additions, -2 deletions)
View changed files
📝
.github/workflows/linux-build-test.yml(+7 -1)📝
src/moonlight-server/platforms/hw_linux.cpp(+5 -1)📝
tests/CMakeLists.txt(+13 -0)➕
tests/testDrmDevice.cpp(+98 -0)📄 Description
Summary
Wolf can close an unrelated file descriptor because a DRM device deleter captures a stack variable by reference; this owns the descriptor by value and tests its full lifetime under AddressSanitizer.
Why This Exists
drm_open_devicereturns a shared owner whose deleter can outlive the function call. Capturing the local descriptor variable by reference leaves that deleter with dangling stack storage. A later cleanup can therefore close whichever descriptor value happens to occupy that memory. FailedopenanddrmGetDevice2paths also need deterministic descriptor cleanup.Resolution
Capture the acquired descriptor by value, reject failed opens before calling libdrm, and close the descriptor when device lookup fails. A Linux-only test executable replaces only the libdrm boundary while exercising real POSIX descriptors and the production owner.
Reviewer Considerations
wolftestsso fake libdrm symbols do not enter the hardware-capable test process.Behavior Changes
DRM discovery now fails immediately when a render node cannot be opened and always releases descriptors on lookup failure or final owner destruction.
Implementation Summary
openbefore callingdrmGetDevice2.Verification
clang-format --dry-run --Werrorwith clang-format 21.1.8.Risk
Low; the runtime change is confined to descriptor ownership and error cleanup, with the former behavior covered directly by the new test.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.