fix(linux): report input access as denied when the event node is unreadable - #787
Open
AalmanSadath wants to merge 2 commits into
Open
fix(linux): report input access as denied when the event node is unreadable#787AalmanSadath wants to merge 2 commits into
AalmanSadath wants to merge 2 commits into
Conversation
…adable The permissions probe checked /dev/uinput and a Logitech /dev/hidraw*, and called both being accessible Granted. The hook also needs to read the mouse's /dev/input/event* node, and that is not implied by the other two: logind does not grant it on its own for a Bluetooth-direct mouse, whose node hangs off /devices/virtual/misc/uhid and has no seat. So a machine carrying udev rules from another Logitech manager reported Granted while button remapping did nothing. HID++ rides hidraw, so the device appeared and DPI and SmartShift worked; evdev::enumerate silently skips a node it cannot open, so the mouse never reached the hook and nothing was logged. Reporting that state as Granted is the one thing the page exists to prevent. Probe the event node too, identifying Logitech by sysfs device/id/vendor the way the hidraw probe already does. A missing event node does not block Granted: only a definite denial downgrades, so a machine where sysfs cannot be read is never reported as broken. The Denied hint named only the first two requirements, which would have sent users to check what was already working, so it now names the event node and says that another manager's rules often cover the first two but not the third. Verified on Fedora 44 by revoking the ACL on the mouse's event node with setfacl: before this change the probe and the GUI both said Granted, after it they say Denied, and both return to Granted once the ACL is restored.
Greptile SummaryThe PR strengthens Linux permission reporting by checking every hook-relevant Logitech event node and ensuring a denied node cannot be masked by a readable sibling.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains, and the previously reported readable-node masking issue is fixed by scanning all matching nodes and giving permission denial precedence.
|
| Filename | Overview |
|---|---|
| crates/openlogi-permissions/src/linux.rs | The event-node probe now scans all hook-relevant Logitech mouse nodes and deterministically reports denial when any matching node is inaccessible. |
| crates/openlogi-permissions/src/tests.rs | Tests cover event-node classification, denial precedence in both enumeration orders, transient errors, and capability-bitmap decoding. |
| crates/openlogi-desktop/src/windows/settings/permissions.rs | Linux permission guidance now explains the event-node access required for button hooks. |
Reviews (2): Last reviewed commit: "fix(linux): count only hookable mouse no..." | Re-trigger Greptile
The event probe stopped at the first readable Logitech node, so one mouse could mask another whose node was denied — and which node came first was only the order readdir happened to return. Raised in review on AprilNEA#787. Letting any denial win is not enough on its own, though. A single Logitech device publishes several event nodes, and the non-pointer ones legitimately carry no uaccess ACL: a G502 HERO exposes "Logitech G502 HERO Gaming Mouse Keyboard" beside the mouse, root-owned, on a correctly configured machine. Counting every node of a Logitech device reported Denied for exactly that, a system where both mice work. So filter to the nodes the hook would actually grab, applying the clicks && moves test its own is_hookable_mouse uses, and let one denial decide among those. The capability bitmaps come from sysfs, whose words run most significant first. fold_event_access is split out so the precedence rule is testable without device nodes, including that it does not depend on walk order. Verified with two Logitech mice attached, an MX Master 3S over Bluetooth and a G502 HERO over USB. With both readable the probe reports Granted, and the G502's companion keyboard node is ignored rather than dragging it to Denied. Revoking the ACL on the G502's mouse node alone reports Denied while the MX Master's node stays readable — the case that previously stopped at the readable node and reported Granted. Its bitmaps, and the MX Master's, are now test fixtures.
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.
Summary
Settings → Permissions checked
/dev/uinputand a Logitech/dev/hidraw*, andcalled both being accessible
Granted. The hook also needs to read the mouse's/dev/input/event*node, and that is not implied by the other two:loginddoes not grant it on its own for a Bluetooth-direct mouse, whose node hangs off
/devices/virtual/misc/uhidand has no seat.docs/INSTALL-linux.mdalreadylists it as a third requirement.
So a machine carrying udev rules left by another Logitech manager reported
Grantedwhile button remapping did nothing. HID++ rides hidraw, so the deviceappeared and DPI and SmartShift worked;
evdev::enumeratesilently skips a nodeit cannot open, so the mouse never reached the hook and nothing was logged.
Reporting that state as
Grantedis the one thing that page exists to prevent.Changes
openlogi-permissions: new
probe_logitech_event(), identifying Logitechby sysfs
device/id/vendorthe wayprobe_logitech_hidrawalready does, andreturning the same tri-state (
Some(true)readable /Some(false)presentbut denied /
Nonenone found).classifytakes it as a third input.A
Noneevent probe deliberately does not blockGranted. Only adefinite denial downgrades, so a machine where sysfs cannot be read is never
reported as broken.
It counts any Logitech event node, not only the mouse's. Telling them apart
means decoding sysfs capability bitmasks, and
uaccessis granted per node bythe same rule, so they stand or fall together.
openlogi-desktop: the
Deniedhint named only the first tworequirements, which would have sent users to check what was already working.
It now names the event node and says another manager's rules often cover the
first two but not the third.
PermissionStatuscarries no serde derives and is not referenced fromopenlogi-ipc, so this is not a wire change andPROTOCOL_VERSIONisuntouched.
Testing
All on Linux with
RUSTFLAGS="-D warnings". The skippedxtask cijob istests (macos), not reproducible on this host, so not claimed green. Bothchanged files are cfg-gated to Linux; the Windows cross-check covers the gating.
Verified on hardware, Fedora 44, MX Master 3S connected Bluetooth-direct,
the case this fix is about. Its event node sits at
/sys/devices/virtual/misc/uhid/0005:046D:B034.0024/input/input98, sologindgrants no ACL on its own and the bundled rule is what makes it readable.
Revoking that ACL with
setfaclleaves/dev/uinputand/dev/hidraw*accessible, which is the exact state this fixes:
GrantedNot grantedBoth return to
Grantedonce the ACL is restored. Four newclassifycasescover the regression and the guard against over-eager denial.
Before fix:

After fix:

Follow-on from #529 / #530, which added the event node to the udev rules and
listed it in
docs/INSTALL-linux.mdas a third requirement. The permissionsprobe was not updated at the time and still checked only
uinputandhidraw,so it reports
Grantedfor a machine missing exactly the access #530 was about.