On Mon, Mar 28, 2022 at 07:47:45AM +0200, Anton Lindqvist wrote:
> On Sun, Mar 27, 2022 at 06:22:20PM -0600, Dave Voutila wrote:
> > CVSROOT:    /cvs
> > Module name:        src
> > Changes by: d...@cvs.openbsd.org    2022/03/27 18:22:20
> > 
> > Modified files:
> >     sys/arch/amd64/amd64: vmm.c 
> > 
> > Log message:
> > vmm(4): add quiesce/wakeup hooks to sync vcpu state.
> > 
> > If a host suspends or hibernates, a task in the middle of using
> > vcpu state may be rescheduled to another cpu. This is primarily a
> > problem for Intel hosts as vcpu state is kept local to the physical
> > cpu and must be flushed back to physical memory before another cpu
> > can issue certain vmx instructions.
> > 
> > This change ensures no tasks are actively using the vmm device,
> > flushes all vcpu state (if Intel hardware), and turns off virtualization
> > mode on the host cpus. Upon wakeup, we reverse the process.
> > 
> > Reported on bugs@ by mpi@. OK mlarkin@
> 
> This broke kernel compilation on syzkaller.
> 
> sys/arch/amd64/amd64/vmm.c:499:11: error: implicit declaration of function 
> 'vmx_remote_vmclear' is invalid in C99 
> [-Werror,-Wimplicit-function-declaration]
> 
> https://syzkaller.appspot.com/bug?id=c58155e5ad57153055f3b4db9d86234cd086fe3b

Just ran into this as well. The below fixes 'make release'. Does this
look right?

Index: arch/amd64/amd64/vmm.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/amd64/vmm.c,v
retrieving revision 1.304
diff -u -p -r1.304 vmm.c
--- arch/amd64/amd64/vmm.c      28 Mar 2022 00:22:20 -0000      1.304
+++ arch/amd64/amd64/vmm.c      28 Mar 2022 05:52:33 -0000
@@ -494,6 +494,7 @@ vmm_quiesce_vmx(void)
                                continue;
                        }
 
+#ifdef MULTIPROCESSOR
                        if (vcpu->vc_last_pcpu != curcpu()) {
                                /* Remote cpu vmclear via ipi. */
                                err = vmx_remote_vmclear(vcpu->vc_last_pcpu,
@@ -502,7 +503,9 @@ vmm_quiesce_vmx(void)
                                        printf("%s: failed to remote vmclear "
                                            "vcpu %d of vm %d\n", __func__,
                                            vcpu->vc_id, vm->vm_id);
-                       } else {
+                       } else
+#endif
+                       {
                                /* Local cpu vmclear instruction. */
                                if ((err = vmclear(&vcpu->vc_control_pa)))
                                        printf("%s: failed to locally vmclear "

Reply via email to