From nobody Wed Aug 28 19:12:45 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WvDZQ1j3zz5MZW7; Wed, 28 Aug 2024 19:12:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WvDZP5ZMGz4pql; Wed, 28 Aug 2024 19:12:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724872365; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=afjc736OpC4MDxUXdy9mhKBlDHgIv3SuwoHHtdiZgfA=; b=i9jIUi4cfB1pVbqn0iFwvZCmCRUBCVv1HyouS/iJsgtS9V6FmXs02tFc+TxbG9KGyttoQK FMPxfZWWrewfD1ZMWk0C1ho2A8BPzllU94A30J4dDPYu5bUnUeLf7hJYZnAToyf/aiBgNB 6fW7VvDAo/d9ovjgkzzXHrJjwwGms/jn3GAVF0MQ2v4SjSyW8VVDqxg8T2PZsI3aqyw3Xe chdoEWbjawlE6QS8+xgB6ezHFiVdyCxCTBr3iyEwSjFmlH+IXrpbLRrEs6/fU3uJ9O8iOY ZSfpDX9kAZ79vvGrXLriOjMcjaom28+vO4DLxB0VbrLmIC1X2QS9tNpDU/WRIg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724872365; a=rsa-sha256; cv=none; b=Nkz7JBZsBTVx7ll+zDu4OFiG7b/8hr3bXOuA6kzd5S4O7DgXrSDwC7uLh8Hf1ZK8whL3GK b/tgq77782H56EHvf9+ao/MqmygR6MzKXqUOPYBHTjzeDbQQ3qJzSS6LNCVcUgIyHeUseO CCRNyT4id2qpQGcuxMkM/qtkIDnuF7eaHrWdBeqc0KUbuseUYyghNTWn5+L1WUgMSZUF6E fwCFInyVtq0NRAGK0sCxh307Rn4rNEbfOCYr7r4vex6IUJkto1XRfsNEFSvXBDxLI5nny4 JtOqlqauAyzO88xei1k6EnutijM5uO6XTGcTz/M/9ZjFlFZ8RI/HSYlXhAsWEQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724872365; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=afjc736OpC4MDxUXdy9mhKBlDHgIv3SuwoHHtdiZgfA=; b=isw+MpBRow9exqa2cGnmokSsvQRCTpBUPTR/dvsO+KypZEUURycDHRmGt1VTbe1Zebo9Ne HDzBZhj+WbS+3zZseYsYDDmNBc9OCQmAHaifohbhkSPCxjk/Hy3NM0MXH8WBP/4U4s1eJF rCkZf3uD3bhdH/uD6syxIJAJ5yYi6IHLidXnQ4ZjYD2lSqVEAFDe9FewdA9Tds7B8eEfDj HSpbO/yHvXJTVaTo29LVvBozHhCWB2ZiZxRpAlopelXB73zKmIdizc0EBQT9ChsJjwinMm GubtDNZ0U67oJERbBjWrXTSv1JwXAG5U+HYNdWZsJmMhwhF4g/v+WUem3EqUwA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WvDZP5BMCzmGb; Wed, 28 Aug 2024 19:12:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 47SJCji6059131; Wed, 28 Aug 2024 19:12:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47SJCjrx059128; Wed, 28 Aug 2024 19:12:45 GMT (envelope-from git) Date: Wed, 28 Aug 2024 19:12:45 GMT Message-Id: <202408281912.47SJCjrx059128@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: c23da668fa8e - main - vmm: Be more consistent with the credential used for VM lookup List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c23da668fa8e341c6f51d70ec632de617b693215 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c23da668fa8e341c6f51d70ec632de617b693215 commit c23da668fa8e341c6f51d70ec632de617b693215 Author: Mark Johnston AuthorDate: 2024-08-28 18:57:33 +0000 Commit: Mark Johnston CommitDate: 2024-08-28 18:57:33 +0000 vmm: Be more consistent with the credential used for VM lookup vmmdev_lookup() is used from sysctl context to find a VM by name. There, a reference credential is already passed, so use that instead of assuming that it's the same as curthread->td_ucred, even though that's true today. No functional change intended. Reviewed by: corvink, jhb Differential Revision: https://reviews.freebsd.org/D46447 --- sys/dev/vmm/vmm_dev.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/dev/vmm/vmm_dev.c b/sys/dev/vmm/vmm_dev.c index c42b2aaee5ed..53b4dc8cda91 100644 --- a/sys/dev/vmm/vmm_dev.c +++ b/sys/dev/vmm/vmm_dev.c @@ -152,7 +152,7 @@ vcpu_unlock_all(struct vmmdev_softc *sc) } static struct vmmdev_softc * -vmmdev_lookup(const char *name) +vmmdev_lookup(const char *name, struct ucred *cred) { struct vmmdev_softc *sc; @@ -166,7 +166,7 @@ vmmdev_lookup(const char *name) if (sc == NULL) return (NULL); - if (cr_cansee(curthread->td_ucred, sc->ucred)) + if (cr_cansee(cred, sc->ucred)) return (NULL); return (sc); @@ -786,7 +786,7 @@ vmmdev_lookup_and_destroy(const char *name, struct ucred *cred) struct vmmdev_softc *sc; mtx_lock(&vmmdev_mtx); - sc = vmmdev_lookup(name); + sc = vmmdev_lookup(name, cred); if (sc == NULL || sc->cdev == NULL) { mtx_unlock(&vmmdev_mtx); return (EINVAL); @@ -860,7 +860,7 @@ vmmdev_create(const char *name, struct ucred *cred) int error; mtx_lock(&vmmdev_mtx); - sc = vmmdev_lookup(name); + sc = vmmdev_lookup(name, cred); mtx_unlock(&vmmdev_mtx); if (sc != NULL) return (EEXIST); @@ -876,7 +876,7 @@ vmmdev_create(const char *name, struct ucred *cred) * dropped the lock. */ mtx_lock(&vmmdev_mtx); - sc2 = vmmdev_lookup(name); + sc2 = vmmdev_lookup(name, cred); if (sc2 != NULL) { mtx_unlock(&vmmdev_mtx); vmmdev_destroy(sc);