From 66fc442421f868b01bee4e299d7e3a4c4df37d21 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Wed, 4 Sep 2024 20:05:33 +0000 Subject: [PATCH] vmm: Remove an incorrect credential check in vmmdev_open() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Checking pointer equality here is too strict and can lead to incorrect errors, as credentials are frequently copied to avoid reference counting overhead. The check is new with commit 4008758105a6 and was added with the goal of allowing non-root users to create VMs in mind. Just remove it for now. Reported by: Alonso Cárdenas Márquez Reviewed by: jhb Fixes: 4008758105a6 ("vmm: Validate credentials when opening a vmmdev") Differential Revision: https://reviews.freebsd.org/D46535 --- sys/dev/vmm/vmm_dev.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sys/dev/vmm/vmm_dev.c b/sys/dev/vmm/vmm_dev.c index ea2aaace832..353b58dd8a2 100644 --- a/sys/dev/vmm/vmm_dev.c +++ b/sys/dev/vmm/vmm_dev.c @@ -331,12 +331,6 @@ vmmdev_open(struct cdev *dev, int flags, int fmt, struct thread *td) sc = vmmdev_lookup2(dev); KASSERT(sc != NULL, ("%s: device not found", __func__)); - /* - * A user can only access VMs that they themselves have created. - */ - if (td->td_ucred != sc->ucred) - return (EPERM); - /* * A jail without vmm access shouldn't be able to access vmm device * files at all, but check here just to be thorough.