On Thu, Oct 05, 2017 at 10:23:58PM +0200, Jesper Wallin wrote:
> Hi again,
>
> Bumping this, as I assume it wasn't prioritized during the beta.
>
We were locked. I'm working backward through emails, should get to this
in the next day or so.
-ml
> On Sun, Sep 24, 2017 at 06:01:00PM +0200, Jesper Wallin wrote:
> > Hi all,
> >
> > If a machine is configured in vm.conf to have the owner of a regular
> > user, the ownership of the machine is lost upon reboot and root becomes
> > the new owner. When restarting the machine, the tty is kept open and
> > the permissions of the tty are untouched. The user can therefore access
> > the console, but it's not possible to stop the machine since the vmd
> > owner is root.
> >
> > The patch below simply leave vm->vm_uid untouched if the keeptty is set.
> >
> >
> > Jesper Wallin
> >
> >
> > Index: vmd.c
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/vmd/vmd.c,v
> > retrieving revision 1.69
> > diff -u -p -r1.69 vmd.c
> > --- vmd.c 8 Sep 2017 06:24:31 -0000 1.69
> > +++ vmd.c 24 Sep 2017 15:04:31 -0000
> > @@ -413,7 +413,7 @@ vmd_dispatch_vmm(int fd, struct privsep_
> > log_debug("%s: about to stop vm id %d with tty open",
> > __func__, vm->vm_vmid);
> > vm_stop(vm, 1);
> > - config_setvm(ps, vm, (uint32_t)-1, 0);
> > + config_setvm(ps, vm, (uint32_t)-1, vm->vm_uid);
> > }
> > break;
> > case IMSG_VMDOP_GET_INFO_VM_DATA:
> > @@ -1061,9 +1061,10 @@ vm_stop(struct vmd_vm *vm, int keeptty)
> > close(vm->vm_kernel);
> > vm->vm_kernel = -1;
> > }
> > - vm->vm_uid = 0;
> > - if (!keeptty)
> > + if (!keeptty) {
> > vm_closetty(vm);
> > + vm->vm_uid = 0;
> > + }
> > }
> >
> > void
>