DF-4911 / aux_chardev_probe.c
/* * DF-4911 probe โ checks whether the raw DP AUX character device exists, * which would give an unprivileged user a direct handle on dm_dp_aux_transfer. * On DragonFly CONFIG_DRM_DP_AUX_CHARDEV is unset (sys/dev/drm/kconfig.h), * so /dev/drm_dp_auxN is never created and the buggy write paths are only * reachable through kernel-initiated DPCD traffic on real AMD DP hardware. */ #include <stdio.h> #include <fcntl.h> #include <unistd.h> #include <errno.h> #include <string.h> int main(void) { int i, found = 0; char path[64]; for (i = 0; i < 16; i++) { snprintf(path, sizeof(path), "/dev/drm_dp_aux%d", i); int fd = open(path, O_RDWR); if (fd >= 0) { printf("FOUND %s โ direct AUX access possible\n", path); close(fd); found++; } } if (!found) printf("no /dev/drm_dp_aux* devices โ AUX chardev disabled; " "dm_dp_aux_transfer reachable only via kernel DPCD " "traffic on AMD hardware\n"); return found ? 0 : 1; } |