Re: git: e11768e94787 - main - vmm: Add PRIV_DRIVER checks for passthru ioctls

From: Mark Johnston <markj_at_freebsd.org>
Date: Tue, 21 Oct 2025 22:18:34 UTC
On Tue, Oct 21, 2025 at 09:02:59PM +0000, Bjoern A. Zeeb wrote:
> On Tue, 21 Oct 2025, Mark Johnston wrote:
> 
> > The branch main has been updated by markj:
> > 
> > URL: https://cgit.FreeBSD.org/src/commit/?id=e11768e94787bef2866486ba8616353716a10447
> > 
> > commit e11768e94787bef2866486ba8616353716a10447
> > Author:     Mark Johnston <markj@FreeBSD.org>
> > AuthorDate: 2025-10-21 17:34:29 +0000
> > Commit:     Mark Johnston <markj@FreeBSD.org>
> > CommitDate: 2025-10-21 17:34:29 +0000
> > 
> >    vmm: Add PRIV_DRIVER checks for passthru ioctls
> > 
> >    In preparation for allowing non-root users to create and access bhyve
> >    VMs, add privilege checks for ioctls which operate on passthru devices.
> 
> Does this mean we need to have a way to give a user a priveledge in order
> to also use pssthru (likely not easily possible currently; different longer
> topic I am happy to talk about as it came up elsewhere recently).
> 
> That said if we go there I think DRIVER may be a dangerous priveledge
> but then again the user may need to setup interfaces for networking just
> as well which is kind of orthotognal to the system administration concept.
> 
> Giving a user PRIV_DRIVER is likely never ever going to be a good idea given
> the catchall it is used as so we one day might need a more flexible, more
> finegrained system ...
> 
> 
> So in conclusion what your commit message is saying (if I understand it right):
> a user will be allowed to start bhyve but not be allowed to use certain features,
> like passthru?

That's right.  I'd like to make it possible to create and run bhyve VMs
as an unprivileged user (provided that they belong to an as-yet
uncreated "vmm" group), but passthru functionality will remain
root-only.

> >    Reviewed by:    corvink
> >    MFC after:      2 weeks
> >    Sponsored by:   The FreeBSD Foundation
> >    Sponsored by:   Klara, Inc.
> >    Differential Revision:  https://reviews.freebsd.org/D53144
> > ---
> > sys/amd64/vmm/vmm_dev_machdep.c | 18 +++++++++++-------
> > sys/dev/vmm/vmm_dev.c           |  7 +++++++
> > sys/dev/vmm/vmm_dev.h           |  1 +
> > 3 files changed, 19 insertions(+), 7 deletions(-)
> 
> -- 
> Bjoern A. Zeeb                                                     r15:7