-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enumerate input/graphics devices with udev #16
base: master
Are you sure you want to change the base?
Conversation
We can query udev to get a list of devices more reliably and simply. For example, the previous code does not detect controllers unless the joydev module (old API) is loaded, whereas udev has already labeled the correct event*, input*, and js* devices with ID_INPUT_JOYSTICK. The same approach can probably be used for video/media devices, but I didn't feel as confident with how to make that change. The added pyudev dependency is documented in the README.
Thank you for submitting this Pull Request. The code is definitely much cleaner with udev. However, I don't really like the I think creating new ctype binds for libudev would be better. There are already separated binds for libseccomp instead of Cython based upstream ones. I will add this to the TODO list. |
I don't think bubblejail would need any I/O calls where asyncio would make a difference. Maybe we could submit a typing PR to the pyudev project? :) |
I am planning on adding dynamic hardware binds. For example, a controller gets plugged and it would be nice if it becomes available in sandbox without restarting. Libudev lets you watch a file descriptor and look for new devices. |
That sounds cool, but will bwrap allow anything to add binds after it is already running? |
You can access the namespaces under the |
I opened two issues on Lets see if it gets any traction. |
Looks like upstream is not interested. Also libudev is actually deprecated. The replacement is sd-device component of libsystemd. Since my D-Bus library is based on libsystemd already might as well add the sd-device component. (elogind for Alpine Linux also supports that) |
Good to know. I still suspect it's unlikely on the bwrap side as well. With its focus on security and simplicity, allowing dynamic changes once the sandbox is established sounds like something they'd consider a bug. |
I thought about that and I think I know the solution: two stage sandbox. Bubblewrap would be the second stage and would just use |
New mount API provides a very easy way to create new bind mounts inside namespace: https://brauner.io/2023/02/28/mounting-into-mount-namespaces.html |
We can query udev to get a list of devices more reliably and simply. For example, the previous code does not detect controllers unless the joydev module (old API) is loaded, whereas udev has already labeled the correct event*, input*, and js* devices with
ID_INPUT_JOYSTICK
.The same approach can probably be used for video/media devices, but I didn't feel as confident with how to make that change.
The added pyudev dependency is documented in the README.