From nobody Mon Oct 25 10:57:06 2021 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A80A618258E4; Mon, 25 Oct 2021 10:57:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HdBjZ4FkWz4QsN; Mon, 25 Oct 2021 10:57:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 70C47275B3; Mon, 25 Oct 2021 10:57:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19PAv6ve059505; Mon, 25 Oct 2021 10:57:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PAv6hs059504; Mon, 25 Oct 2021 10:57:06 GMT (envelope-from git) Date: Mon, 25 Oct 2021 10:57:06 GMT Message-Id: <202110251057.19PAv6hs059504@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Guido Falsi Subject: git: 32c43c505242 - main - emulators/virtualbox-ose*: Fix mistake in patch List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: madpilot X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 32c43c505242463fb127845d0208ecf345124d13 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by madpilot: URL: https://cgit.FreeBSD.org/ports/commit/?id=32c43c505242463fb127845d0208ecf345124d13 commit 32c43c505242463fb127845d0208ecf345124d13 Author: Guido Falsi AuthorDate: 2021-10-25 10:46:17 +0000 Commit: Guido Falsi CommitDate: 2021-10-25 10:57:01 +0000 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 (via mailing list) Fixes: a3db7da59f9498 --- emulators/virtualbox-ose-kmod/Makefile | 1 + emulators/virtualbox-ose/Makefile | 25 ++++++++++---------- ...ox_HostDrivers_Support_freebsd_SUPDrv-freebsd.c | 27 +++++++++++----------- 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) {