Re: Kernel error reports from VirtualBax

From: Guido Falsi via emulation <emulation_at_freebsd.org>
Date: Mon, 25 Oct 2021 07:35:01 UTC
On 25/10/21 08:23, Kevin Oberman wrote:
> Since the update to virtualbox-ose-kmod-6.1.28, I have been seeing a very
> large number of the error:
> vboxdrv: Bad CPU context error at line 373 in SUPDrv-freebsd.c:
> ulCmd=0x2000568a: 0x282->0x287!
> hundreds of times a day.
> 
> I have seen no actual issues with my VMs. They run fine as far as I can
> tell. Any idea if I need to worry about these messages? Any explanation of
> what they might mean?

I have no idea of what this means, but a quick look at the port shows 
this is a wasrning we are adding in out patches, from 
patch-src_VBox_HostDrivers_Support_freebsd_SUPDrv-freebsd.c:

+#ifdef VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV
+    /*
+     * Before we restore AC and the rest of EFLAGS, check if the IOCtl 
handler code
+     * accidentially modified it or some other important flag.
+     */
+    if (RT_UNLIKELY(   (ASMGetFlags() & (X86_EFL_AC | X86_EFL_IF | 
X86_EFL_DF | X86_EFL_IOPL))
+                    != ((fSavedEfl    & (X86_EFL_AC | X86_EFL_IF | 
X86_EFL_DF | X86_EFL_IOPL)) | X86_EFL_AC) ))
+    {
+        char szTmp[48];
+        RTStrPrintf(szTmp, sizeof(szTmp), "ulCmd=%#x: %#x->%#x!", 
ulCmd, (uint32_t)fSavedEfl, (uint32_t)ASMGetFlags());
+        supdrvBadContext(&g_VBoxDrvFreeBSDDevExt, "SUPDrv-freebsd.c", 
__LINE__, szTmp);
+    }
+#endif

Maybe someone with bettern kernel/architecture knowledge can make 
something out from this piece of code.


-- 
Guido Falsi <mad@madpilot.net>