DF-5193 / drm_sg_probe.c
/* * drm_sg_probe.c -- DF-5193 guest probe (run as root) * * Attempts to reach drm_legacy_sg_alloc / drm_legacy_sg_free via * DRM_IOCTL_SG_ALLOC on any DRM device node present. * * Expected on this guest (QEMU std-VGA, no GPU): no /dev/dri/* and no * /dev/drm/* nodes exist -> open() fails ENOENT -> the scatter-gather * path has no runtime surface here. * * Even on a DRM-equipped system the path is double-gated: * - drm_ioctl.c:636-637: DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY * (capable(CAP_SYS_ADMIN) -> caps_priv_check_self, drm_ioctl.c:538) * - no in-tree driver sets DRIVER_SG(0x10)|DRIVER_LEGACY(0x2) * (i915_drv.c:3284, radeon_drv.c:671) so drm_scatter.c:69-73/125-129 * returns -EOPNOTSUPP even for root. */ #include <fcntl.h> #include <errno.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <sys/ioctl.h> int main(void) { static const char *nodes[] = { "/dev/dri/card0", "/dev/dri/renderD128", "/dev/drm/0", "/dev/dri0", NULL }; int i, fd; for (i = 0; nodes[i]; i++) { errno = 0; fd = open(nodes[i], O_RDWR); printf("open(%s) -> fd=%d errno=%d (%s)\n", nodes[i], fd, errno, fd < 0 ? strerror(errno) : "opened"); if (fd >= 0) close(fd); } printf("[*] kldstat modules and /boot/kernel contents carry the " "authoritative answer: which drm drivers exist at all.\n"); return 0; } |