xocl udev rules are too liberal
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 686
- Forks
- 549
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 70
Description
The /etc/udev/rules.d/99-xocl.rules has a rule:
KERNEL=="renderD*",MODE="0666"
to make the DRM control file usable by anybody.
But it changes all these files on the system, like the one for my AMD and Nvidia GPU on my machine to mode 0666 instead of 0660, not only the ones controlled by xocl.
/usr/lib/udev/rules.d/50-udev-default.rules defines a rule for the renderD files to set the mode to 0660, which means that it requires to be root or group render to use this.
A minimal change could be
KERNEL=="renderD*", DRIVERS=="xocl", MODE="0666"
This has been experimented on Ubuntu 22.04:
udevadm test $(udevadm info --query=path --name=/dev/dri/renderD130) |& grep MODE
At the end, while I understand the comfort of 0666, I am unsure about the security impact for FPGA, compared to restricting it to some user groups. Of course there is no bug in our software, so we are safe. :-)
At least we should not change the security model for other devices.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with /etc/udev/rules.d/99-xocl.rules and compare its renderD rule with /usr/lib/udev/rules.d/50-udev-default.rules. Run the provided udevadm test command on an xocl and a non-xocl render device. Done means xocl devices retain the intended access while unrelated render devices remain at mode 0660.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux
- Domain
- operating-systems, security
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100