GPU and camera¶
Part of Desktop access. Previous: audio. Next: network.
What it is¶
Programs reach hardware through device nodes in /dev, special files that lead to a kernel driver.
- The GPU is reached through the DRM subsystem:
/dev/dri/card*nodes (the display hardware, mostly for the compositor) and/dev/dri/renderD*render nodes, which allow rendering and computing without control of the display. NVIDIA's proprietary driver adds/dev/nvidia*. Graphics libraries also read details of the hardware in/sysand configuration for Vulkan and GLVND. - Cameras are V4L2 devices,
/dev/video*. One camera often has several nodes: video capture, metadata, sometimes output or codec nodes; a media controller node (/dev/media*) describes how they connect. A driver tells what a node is through theVIDIOC_QUERYCAPrequest.
Why it matters¶
A device node is a direct line to a kernel driver: each one is attack surface, and GPU drivers are large. The GPU also
reveals hardware details through /sys. A camera node is the camera itself, with no prompt. Many apps need neither:
most command-line tools, converters and editors render fine without a GPU.
How appjail uses it¶
- Nothing by default. The jail has a minimal
/dev(null, zero, random, terminal devices). gpubinds/dev/dri(card and render nodes) and/dev/nvidia*, and read-only/sys/dev/char,/sys/devicesand the Vulkan and GLVND data. Your supplementary groups are kept in the jail, so group-owned render nodes stay usable.camerabinds only the/dev/video*nodes whose driver reports video capture, and for each only its own/sysdirectory (read-only, with the/sys/dev/charlink that tools follow to identify it). Output, metadata and codec nodes and the media controller stay out; the rest of/sysis absent unlessgpuis granted too. The seccomp filter lets the V4L2 requests through.- A limit. GNOME's Wayland socket lists
wp_drm_lease_device_v1, which sends every client with a window an unprivileged render-node descriptor, with or withoutgpu: the driver's attack surface, not control of the display (why it is allowed). Not grantinggpukeeps the device nodes and/sysout of the jail, not that descriptor. - The Camera portal is the route for apps that reach the camera through PipeWire (browsers):
--allow portals --portal Camera. No device is bound into the jail then; the portal asks you.
Connections¶
- PipeWire cannot hide a camera from a client it does not recognise as sandboxed (audio), which is why the camera is either device nodes or the portal, never the host's PipeWire.
- A webcam's microphone is an audio device, covered by
mic, not bycamera. - Decision: Camera: the capture nodes only.
Limits¶
- Every capture device present at start is visible; there is no per-camera choice, and a camera plugged in later appears at the next start.
- An app that finds its camera by listing
/devand filtering on the file type sees none. bwrap builds/devas a tmpfs and mounts each granted node over a placeholder file, so a directory listing reports the node as a regular file, whilestatandopenon its path see the device. Apps that open/dev/video0by path work; Webcamoid's V4L2 plugin, which lists/devwith Qt'sQDir::Systemfilter, finds nothing (measured with a real laptop camera: it finds both nodes once the host's/devis bound whole; evidence). appjail does not bind the whole of/devto work around it. The Camera portal does not help: it is for apps that connect to PipeWire through the portal, and Webcamoid's PipeWire plugin neither calls it nor loads in the AppImage tested. - Tested with the kernel's
vividvirtual camera and, for V4L2 capture, one real laptop camera (Webcamoid, the listing problem above); a real USB webcam, unplugging while the app runs, and a real camera through the portal are still to check.
References¶
- Linux kernel documentation, DRM userspace interface (render nodes); V4L2 and VIDIOC_QUERYCAP; the vivid driver.