Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • None of those files have setgid or setuid permssions and ps -o user= -C Xorg also shows me as the user not root. I know the problem is udev related because if I create a uinput device and set too many UI_SET_KEYBITs for EV_KEY, the corresponding /dev/input/event file will still have the same permissions and group as the other ones but X11 drivers do not have the permission to read them. The Xorg log will show permission denied errors when opening the event file. If I put myself in input group or use less UI_SET_KEYBITs when creating uinput device, X11 can open the device. Commented Mar 21, 2023 at 7:34
  • I'm pretty sure the udev rules for wierd devices like a device that has the capability to emulate all keys doesn't exist and that is why X cannot read them. This has to be udev related. It must not recognize the device as a valid one and not give permissions to the drivers to read them. The device is fine by the way. sudo evtest can read the events just fine and linux console can interpret them correctly as well. X on the other hand gives permission denied errors. Commented Mar 21, 2023 at 7:39
  • 1
    Udev will not grant extra privileges to any processes that are not its descendants. Modern versions of udev will heavily discourage you from starting long-term processes from udev. Udev is not even aware that you are starting an X server, so what you are thinking seems impossible to me. It turns out that modern Xorg X server uses a dedicated Xorg.wrap wrapper binary, located in /usr/lib/xorg/Xorg.wrap, at least on my Debian 11. See my edit above. Commented Mar 21, 2023 at 10:06
  • On Arch its in /usr/lib/Xorg.wrap and it is setuid! So that is how it has the privileges! But It doesn't explain why Xorg drivers show permission denied errors if the /dev/input/event device is weird like I explained in the above comments. How can it be run as root but not be able to read a device that has the same privileges as the others? It seems like something else determines if the device should be opened with root privileges or user privileges. That's why I suspected udev. Can this be related to systemd somehow? I'm really lost here. Commented Mar 21, 2023 at 10:35
  • I have added a minimal example c program that demonstrate it. Commented Mar 21, 2023 at 14:09