// https://syzkaller.appspot.com/bug?id=44925b97839ae6cfc4c4a2f0ba25f74b44ee1a98 #include #include #include #include #include #include #include int main(void) { int fd; DIR *dir; struct dirent *ent; // Trigger module load fd = open("/dev/vhci", O_RDWR); if (fd >= 0) { close(fd); } printf("[+] /dev/vhci opened and closed.\n"); // Iterate platform devices dir = opendir("/sys/bus/platform/devices/"); if (!dir) { printf("[-] Failed to opendir /sys/bus/platform/devices/: %s\n", strerror(errno)); exit(1); } printf("[+] Opened /sys/bus/platform/devices/\n"); while ((ent = readdir(dir)) != NULL) { if (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, "..")) continue; if (!strncmp(ent->d_name, "vhci_hcd", 8)) continue; printf("[*] Trying device: %s\n", ent->d_name); char path[512]; // Unbind existing driver snprintf(path, sizeof(path), "/sys/bus/platform/devices/%s/driver/unbind", ent->d_name); fd = open(path, O_WRONLY); if (fd >= 0) { ssize_t res = write(fd, ent->d_name, strlen(ent->d_name)); (void)res; close(fd); } // Set driver override snprintf(path, sizeof(path), "/sys/bus/platform/devices/%s/driver_override", ent->d_name); fd = open(path, O_WRONLY); if (fd >= 0) { ssize_t res = write(fd, "vhci_hcd", 8); (void)res; close(fd); } else { continue; } // Bind to vhci_hcd fd = open("/sys/bus/platform/drivers/vhci_hcd/bind", O_WRONLY); if (fd >= 0) { ssize_t res = write(fd, ent->d_name, strlen(ent->d_name)); (void)res; close(fd); } } closedir(dir); printf("[+] Done.\n"); return 0; }