aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Falsi <madpilot@FreeBSD.org>2021-10-25 10:46:17 +0000
committerGuido Falsi <madpilot@FreeBSD.org>2021-10-25 10:57:01 +0000
commit32c43c505242463fb127845d0208ecf345124d13 (patch)
tree2fda3205b19925e100b1ce28a0686e8ec341e349
parent07466d961d98de555441ceeeabedc0a31a13efa2 (diff)
downloadports-32c43c505242463fb127845d0208ecf345124d13.tar.gz
ports-32c43c505242463fb127845d0208ecf345124d13.zip
emulators/virtualbox-ose*: Fix mistake in patch
In the commit to update virtualbox-ose to 6.1.28 I made a one line mistake when reapplying a patch which failed to apply as is. In the patch files/patch-src_VBox_HostDrivers_Support_freebsd_SUPDrv-freebsd.c I did not replay a part removing the line: rc = copyout(pHdr, pvUser, cbOut); which was rewriting some data that it should not. The correct code was anyway present after this leftover statement. This error made virtualbox log a lot of warnings about Bad CPU context like this: vboxdrv: Bad CPU context error at line 373 in SUPDrv-freebsd.c: ulCmd=0x2000568a: 0x282->0x287! These seem to be unharmful, but anyway indicate a problem that this commit fixes. Reported by: Kevin Oberman <rkoberman@gmail.com> (via mailing list) Fixes: a3db7da59f9498
-rw-r--r--emulators/virtualbox-ose-kmod/Makefile1
-rw-r--r--emulators/virtualbox-ose/Makefile25
-rw-r--r--emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_Support_freebsd_SUPDrv-freebsd.c27
3 files changed, 28 insertions, 25 deletions
diff --git a/emulators/virtualbox-ose-kmod/Makefile b/emulators/virtualbox-ose-kmod/Makefile
index aff77a142130..8ffae3e1fb43 100644
--- a/emulators/virtualbox-ose-kmod/Makefile
+++ b/emulators/virtualbox-ose-kmod/Makefile
@@ -2,6 +2,7 @@
PORTNAME= virtualbox-ose
PORTVERSION= 6.1.28
+PORTREVISION= 1
CATEGORIES= emulators
MASTER_SITES= https://download.virtualbox.org/virtualbox/${PORTVERSION}/
PKGNAMESUFFIX= -kmod
diff --git a/emulators/virtualbox-ose/Makefile b/emulators/virtualbox-ose/Makefile
index 55e26ad90f58..0b59cc614327 100644
--- a/emulators/virtualbox-ose/Makefile
+++ b/emulators/virtualbox-ose/Makefile
@@ -2,6 +2,7 @@
PORTNAME= virtualbox-ose
PORTVERSION= 6.1.28
+PORTREVISION= 1
CATEGORIES= emulators
MASTER_SITES= https://download.virtualbox.org/virtualbox/${PORTVERSION}/
DISTFILES= VirtualBox-${PORTVERSION}${EXTRACT_SUFX} ${GUESTADDITIONS}
@@ -233,18 +234,18 @@ PLIST_SUB+= PYTHON_PYCDIR=/ \
CONFIGURE_ARGS+= --with-openssl-dir="${OPENSSLBASE}"
.endif
-pre-everything::
-.if ${ARCH} == "amd64"
-.if ${_ELF32} != yes
- @${ECHO_MSG} 'Requires 32-bit runtime support in kernel.'
- @${ECHO_MSG} 'Rebuild kernel with "options COMPAT_FREEBSD32" and reboot.'
- @${FALSE}
-.elif !exists(/usr/lib32/libc.so)
- @${ECHO_MSG} 'Requires 32-bit libraries installed under /usr/lib32.'
- @${ECHO_MSG} 'Do: cd /usr/src; make build32 install32; service ldconfig restart'
- @${FALSE}
-.endif
-.endif
+#pre-everything::
+#.if ${ARCH} == "amd64"
+#.if ${_ELF32} != yes
+# @${ECHO_MSG} 'Requires 32-bit runtime support in kernel.'
+# @${ECHO_MSG} 'Rebuild kernel with "options COMPAT_FREEBSD32" and reboot.'
+# @${FALSE}
+#.elif !exists(/usr/lib32/libc.so)
+# @${ECHO_MSG} 'Requires 32-bit libraries installed under /usr/lib32.'
+# @${ECHO_MSG} 'Do: cd /usr/src; make build32 install32; service ldconfig restart'
+# @${FALSE}
+#.endif
+#.endif
post-patch:
@${ECHO_CMD} 'VBOX_PATH_APP_PRIVATE_ARCH = ${VBOX_DIR}' > \
diff --git a/emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_Support_freebsd_SUPDrv-freebsd.c b/emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_Support_freebsd_SUPDrv-freebsd.c
index a7851ac20503..fb3a4470d560 100644
--- a/emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_Support_freebsd_SUPDrv-freebsd.c
+++ b/emulators/virtualbox-ose/files/patch-src_VBox_HostDrivers_Support_freebsd_SUPDrv-freebsd.c
@@ -50,11 +50,10 @@
/*
* Configure character devices. Add symbolic links for compatibility.
*/
-@@ -322,7 +340,45 @@ static int VBoxDrvFreeBSDIOCtl(struct cdev *pDev, u_lo
- return VBoxDrvFreeBSDIOCtlSlow(pSession, ulCmd, pvData, pTd);
- }
+@@ -324,6 +342,45 @@ static int VBoxDrvFreeBSDIOCtl(struct cdev *pDev, u_lo
+
-+ /**
+ /**
+ * Alternative Device I/O Control entry point on hosts with SMAP support.
+ *
+ * @returns depends...
@@ -71,7 +70,7 @@
+ * SMAP check.
+ */
+ RTCCUINTREG fSavedEfl = ASMAddFlags(X86_EFL_AC);
-
++
+ int rc = VBoxDrvFreeBSDIOCtl(pDev, ulCmd, pvData, fFile, pTd);
+
+#ifdef VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV
@@ -93,10 +92,11 @@
+}
+
+
- /**
++/**
* Deal with the 'slow' I/O control requests.
*
-@@ -372,11 +428,10 @@ static int VBoxDrvFreeBSDIOCtlSlow(PSUPDRVSESSION pSes
+ * @returns 0 on success, appropriate errno on failure.
+@@ -372,11 +429,10 @@ static int VBoxDrvFreeBSDIOCtlSlow(PSUPDRVSESSION pSes
*/
SUPREQHDR Hdr;
pvUser = *(void **)pvData;
@@ -111,7 +111,7 @@
}
if (RT_UNLIKELY((Hdr.fFlags & SUPREQHDR_FLAGS_MAGIC_MASK) != SUPREQHDR_FLAGS_MAGIC))
{
-@@ -401,13 +456,12 @@ static int VBoxDrvFreeBSDIOCtlSlow(PSUPDRVSESSION pSes
+@@ -401,13 +457,12 @@ static int VBoxDrvFreeBSDIOCtlSlow(PSUPDRVSESSION pSes
OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: failed to allocate buffer of %d bytes; ulCmd=%#lx\n", cbReq, ulCmd));
return ENOMEM;
}
@@ -129,10 +129,11 @@
}
if (Hdr.cbIn < cbReq)
RT_BZERO((uint8_t *)pHdr + Hdr.cbIn, cbReq - Hdr.cbIn);
-@@ -436,8 +490,8 @@ static int VBoxDrvFreeBSDIOCtlSlow(PSUPDRVSESSION pSes
+@@ -435,9 +490,8 @@ static int VBoxDrvFreeBSDIOCtlSlow(PSUPDRVSESSION pSes
+ OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: too much output! %#x > %#x; uCmd=%#lx!\n", cbOut, cbReq, ulCmd));
cbOut = cbReq;
}
- rc = copyout(pHdr, pvUser, cbOut);
+- rc = copyout(pHdr, pvUser, cbOut);
- if (RT_UNLIKELY(rc))
- OSDBGPRINT(("VBoxDrvFreeBSDIOCtlSlow: copyout(%p,%p,%#x) -> %d; uCmd=%#lx!\n", pHdr, pvUser, cbOut, rc, ulCmd));
+ if (RT_FAILURE(RTR0MemUserCopyTo(pvUser, pHdr, cbOut)))
@@ -150,10 +151,10 @@
}
-@@ -623,20 +676,43 @@ int VBOXCALL supdrvOSMsrProberModify(RTCPUID idCpu,
-
+@@ -624,19 +677,43 @@ int VBOXCALL supdrvOSMsrProberModify(RTCPUID idCpu,
#endif /* SUPDRV_WITH_MSR_PROBER */
+
+/**
+ * Check if the CPU has SMAP support.
+ */
@@ -165,7 +166,7 @@
+#endif
+ return false;
+}
-
++
+
SUPR0DECL(int) SUPR0PrintfV(const char *pszFormat, va_list va)
{