Skip to content

fix(udev) Resolve permission errors when unhiding devices (#582)#586

Open
dripsnek wants to merge 1 commit into
ShadowBlip:mainfrom
dripsnek:bug/582
Open

fix(udev) Resolve permission errors when unhiding devices (#582)#586
dripsnek wants to merge 1 commit into
ShadowBlip:mainfrom
dripsnek:bug/582

Conversation

@dripsnek

@dripsnek dripsnek commented May 12, 2026

Copy link
Copy Markdown

For devices which use FACLs as part of their udev rules e.g. TAG+="uaccess":
When hiding devices their permissions are modified using chmod, setting a ceiling as to what the FACL permissions can be on that node. Where present, these prohibit the 'pre-hidden' permissions from being reapplied by udev when the device is restored. By clearing any FACLs when hiding, this allows them to be reapplied cleanly when udevadm is reloaded. Devices which do not use FACLs should be unaffected by the additional commands.

For everything else:
An additional check is made for the /dev/inputplumber/sources folder during unhide_all() to prevent a file not found error from propagating which can in some circumstances prevent udevadm from firing leading to incomplete device restoration.

Resolves #582

Comment thread src/udev/mod.rs Outdated

@pastaq pastaq left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor nit that I see.

@pastaq pastaq left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still need to test this, but the code looks good.

@pastaq

pastaq commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

This seems to break hiding for hidraw devices

Before patch:

hidraw0: /usr/lib/udev/rules.d/50-8bitdo-u2-controller.rules:2 MODE 0660
hidraw0: /usr/lib/udev/rules.d/50-8bitdo-u2-controller.rules:3 MODE 0660
hidraw0: /run/udev/rules.d/50-inputplumber-hide-hidraw0-early.rules:7 GROUP 0
hidraw0: /run/udev/rules.d/50-inputplumber-hide-hidraw0-early.rules:7 MODE 0
hidraw0: /run/udev/rules.d/50-inputplumber-hide-hidraw0-early.rules:7 Added SYMLINK 'inputplumber/by-hidden/hidraw0'
hidraw0: /run/udev/rules.d/50-inputplumber-hide-hidraw0-early.rules:7 RUN '/usr/bin/chmod 000 /dev/%k'
hidraw0: /usr/lib/udev/rules.d/50-udev-default.rules:17 Importing properties from results of builtin command 'hwdb'
hidraw0: hwdb modalias key: "hid:b0003g0001v00002DC8p00006012"
hidraw0: hwdb modalias key: "usb:v2DC8p6012d0001dc00dsc00dp00ic03isc00ip00in00"
hidraw0: /usr/lib/udev/rules.d/60-fido-id.rules:5 Importing properties from results of 'fido_id'
hidraw0: Starting 'fido_id'
Successfully forked off '(spawn)' as PID 10853.
Skipping PR_SET_MM, as we don't have privileges.
hidraw0: 'fido_id'(err) 'Failed to get current device from environment: Invalid argument'
hidraw0: Process 'fido_id' failed with exit code 1.
hidraw0: /usr/lib/udev/rules.d/60-fido-id.rules:5 Command "fido_id" returned 1 (error), ignoring
hidraw0: /usr/lib/udev/rules.d/71-seat.rules:75 Importing properties from results of builtin command 'path_id'
hidraw0: /usr/lib/udev/rules.d/73-seat-late.rules:16 RUN 'uaccess'
hidraw0: /run/udev/rules.d/96-inputplumber-hide-hidraw0-late.rules:7 RUN '/usr/bin/chmod 000 /dev/%k'

c---------+  1 root root   245,     0 Jun 12 22:38 hidraw0

After patch:

hidraw0: /usr/lib/udev/rules.d/50-8bitdo-u2-controller.rules:2 MODE 0660
hidraw0: /usr/lib/udev/rules.d/50-8bitdo-u2-controller.rules:3 MODE 0660
hidraw0: /usr/lib/udev/rules.d/50-udev-default.rules:17 Importing properties from results of builtin command 'hwdb'
hidraw0: hwdb modalias key: "hid:b0003g0001v00002DC8p00006012"
hidraw0: hwdb modalias key: "usb:v2DC8p6012d0001dc00dsc00dp00ic03isc00ip00in00"
hidraw0: /usr/lib/udev/rules.d/60-fido-id.rules:5 Importing properties from results of 'fido_id'
hidraw0: Starting 'fido_id'
Successfully forked off '(spawn)' as PID 12379.
Skipping PR_SET_MM, as we don't have privileges.
hidraw0: 'fido_id'(err) 'Failed to get current device from environment: Invalid argument'
hidraw0: Process 'fido_id' failed with exit code 1.
hidraw0: /usr/lib/udev/rules.d/60-fido-id.rules:5 Command "fido_id" returned 1 (error), ignoring
hidraw0: /usr/lib/udev/rules.d/71-seat.rules:75 Importing properties from results of builtin command 'path_id'
hidraw0: /usr/lib/udev/rules.d/73-seat-late.rules:16 RUN 'uaccess'

crw-rw----+  1 root root   245,     0 Jun 12 22:45 hidraw0

@dripsnek

Copy link
Copy Markdown
Author

Can't replicate my end using a 0.77.1 baseline, using automanage on/off on a profile and devices manage-all --enable post daemon start. The lack of udev rules firing from /run/udev/rules.d/ in your log makes me wonder if it is bailing out early due to not finding setfacl?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Device nodes not being unhidden correctly

3 participants