Date: Thu, 18 Mar 2021 15:51:09 +0000 (UTC) From: Neel Chauhan <nc@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r568745 - in head/emulators: virtualbox-ose-kmod virtualbox-ose/files Message-ID: <202103181551.12IFp9GB022901@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nc Date: Thu Mar 18 15:51:08 2021 New Revision: 568745 URL: https://svnweb.freebsd.org/changeset/ports/568745 Log: emulators/virtualbox-ose-kmod: Fix kernel panic on 13/14 with bridge mode by adding EPOCH support In r560502, I added a patch to support EPOCH to VirtualBox 5. When we upgraded to VirtualBox 6, that patch was (unintentionally) removed, making it impossible to use bridge move without this current patch. Approved by: jkim, madpilot Differential Revision: https://reviews.freebsd.org/D29319 Modified: head/emulators/virtualbox-ose-kmod/Makefile head/emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetFlt-freebsd-VBoxNetFlt-freebsd.c Modified: head/emulators/virtualbox-ose-kmod/Makefile ============================================================================== --- head/emulators/virtualbox-ose-kmod/Makefile Thu Mar 18 15:31:26 2021 (r568744) +++ head/emulators/virtualbox-ose-kmod/Makefile Thu Mar 18 15:51:08 2021 (r568745) @@ -3,6 +3,7 @@ PORTNAME= virtualbox-ose PORTVERSION= 6.1.18 +PORTREVERSION= 1 CATEGORIES= emulators MASTER_SITES= https://download.virtualbox.org/virtualbox/${PORTVERSION}/ PKGNAMESUFFIX= -kmod Modified: head/emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetFlt-freebsd-VBoxNetFlt-freebsd.c ============================================================================== --- head/emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetFlt-freebsd-VBoxNetFlt-freebsd.c Thu Mar 18 15:31:26 2021 (r568744) +++ head/emulators/virtualbox-ose/files/patch-src-VBox-HostDrivers-VBoxNetFlt-freebsd-VBoxNetFlt-freebsd.c Thu Mar 18 15:51:08 2021 (r568745) @@ -1,4 +1,4 @@ ---- src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c.orig 2019-04-16 10:16:39 UTC +--- src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c.orig 2021-01-07 15:41:28 UTC +++ src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c @@ -52,6 +52,7 @@ #include <net/if_dl.h> @@ -16,7 +16,22 @@ static int vboxnetflt_modevent(struct module *, int, void *); static ng_constructor_t ng_vboxnetflt_constructor; -@@ -436,6 +438,8 @@ static void vboxNetFltFreeBSDinput(void *arg, int pend +@@ -361,7 +363,14 @@ static int ng_vboxnetflt_rcvdata(hook_p hook, item_p i + { + if (mtag != NULL || !fActive) + { ++#if __FreeBSD_version >= 1300049 ++ struct epoch_tracker et; ++ NET_EPOCH_ENTER(et); ++#endif + ether_demux(ifp, m); ++#if __FreeBSD_version >= 1300049 ++ NET_EPOCH_EXIT(et); ++#endif + if (fActive) + vboxNetFltRelease(pThis, true /*fBusy*/); + VBOXCURVNET_RESTORE(); +@@ -436,6 +445,8 @@ static void vboxNetFltFreeBSDinput(void *arg, int pend struct ifnet *ifp = pThis->u.s.ifp; unsigned int cSegs = 0; bool fDropIt = false, fActive; @@ -25,7 +40,7 @@ PINTNETSG pSG; VBOXCURVNET_SET(ifp->if_vnet); -@@ -448,6 +452,19 @@ static void vboxNetFltFreeBSDinput(void *arg, int pend +@@ -448,6 +459,19 @@ static void vboxNetFltFreeBSDinput(void *arg, int pend if (m == NULL) break; @@ -45,7 +60,7 @@ for (m0 = m; m0 != NULL; m0 = m0->m_next) if (m0->m_len > 0) cSegs++; -@@ -462,6 +479,27 @@ static void vboxNetFltFreeBSDinput(void *arg, int pend +@@ -462,10 +486,39 @@ static void vboxNetFltFreeBSDinput(void *arg, int pend vboxNetFltFreeBSDMBufToSG(pThis, m, pSG, cSegs, 0); fDropIt = pThis->pSwitchPort->pfnRecv(pThis->pSwitchPort, NULL /* pvIf */, pSG, INTNETTRUNKDIR_WIRE); RTMemTmpFree(pSG); @@ -72,8 +87,21 @@ + if (fDropIt) m_freem(m); - else -@@ -521,6 +559,7 @@ static void vboxNetFltFreeBSDoutput(void *arg, int pen +- else ++ else { ++#if __FreeBSD_version >= 1300049 ++ struct epoch_tracker et; ++ NET_EPOCH_ENTER(et); ++#endif + ether_demux(ifp, m); ++#if __FreeBSD_version >= 1300049 ++ NET_EPOCH_EXIT(et); ++#endif ++ } + } + vboxNetFltRelease(pThis, true /* fBusy */); + VBOXCURVNET_RESTORE(); +@@ -521,6 +574,7 @@ static void vboxNetFltFreeBSDoutput(void *arg, int pen */ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *pvIfData, PINTNETSG pSG, uint32_t fDst) { @@ -81,7 +109,7 @@ NOREF(pvIfData); void (*input_f)(struct ifnet *, struct mbuf *); -@@ -537,10 +576,16 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *p +@@ -537,10 +591,16 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *p { m = vboxNetFltFreeBSDSGMBufFromSG(pThis, pSG); if (m == NULL) @@ -98,7 +126,7 @@ m->m_flags |= M_PKTHDR; ether_output_frame(ifp, m); -@@ -550,10 +595,16 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *p +@@ -550,10 +610,16 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *p { m = vboxNetFltFreeBSDSGMBufFromSG(pThis, pSG); if (m == NULL) @@ -115,7 +143,7 @@ /* * Delivering packets to the host will be captured by the * input hook. Tag the packet with a mbuf tag so that we -@@ -564,6 +615,7 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *p +@@ -564,6 +630,7 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *p if (mtag == NULL) { m_freem(m); @@ -123,7 +151,7 @@ return VERR_NO_MEMORY; } -@@ -574,6 +626,7 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *p +@@ -574,6 +641,7 @@ int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *p ifp->if_input(ifp, m); } VBOXCURVNET_RESTORE(); @@ -131,7 +159,7 @@ return VINF_SUCCESS; } -@@ -586,6 +639,7 @@ static bool vboxNetFltFreeBsdIsPromiscuous(PVBOXNETFLT +@@ -586,6 +654,7 @@ static bool vboxNetFltFreeBsdIsPromiscuous(PVBOXNETFLT int vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, void *pvContext) { @@ -139,7 +167,7 @@ char nam[NG_NODESIZ]; struct ifnet *ifp; node_p node; -@@ -594,7 +648,10 @@ int vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, voi +@@ -594,7 +663,10 @@ int vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, voi NOREF(pvContext); ifp = ifunit(pThis->szName); if (ifp == NULL) @@ -150,7 +178,7 @@ /* Create a new netgraph node for this instance */ if (ng_make_node_common(&ng_vboxnetflt_typestruct, &node) != 0) -@@ -638,12 +695,14 @@ int vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, voi +@@ -638,12 +710,14 @@ int vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, voi vboxNetFltRelease(pThis, true /*fBusy*/); } VBOXCURVNET_RESTORE(); @@ -165,7 +193,7 @@ struct ifnet *ifp, *ifp0; ifp = ASMAtomicUoReadPtrT(&pThis->u.s.ifp, struct ifnet *); -@@ -660,6 +719,7 @@ bool vboxNetFltOsMaybeRediscovered(PVBOXNETFLTINS pThi +@@ -660,6 +734,7 @@ bool vboxNetFltOsMaybeRediscovered(PVBOXNETFLTINS pThi pThis->u.s.node = NULL; } VBOXCURVNET_RESTORE(); @@ -173,7 +201,7 @@ if (ifp0 != NULL) { -@@ -672,6 +732,7 @@ bool vboxNetFltOsMaybeRediscovered(PVBOXNETFLTINS pThi +@@ -672,6 +747,7 @@ bool vboxNetFltOsMaybeRediscovered(PVBOXNETFLTINS pThi void vboxNetFltOsDeleteInstance(PVBOXNETFLTINS pThis) { @@ -181,7 +209,7 @@ taskqueue_drain(taskqueue_fast, &pThis->u.s.tskin); taskqueue_drain(taskqueue_fast, &pThis->u.s.tskout); -@@ -684,6 +745,7 @@ void vboxNetFltOsDeleteInstance(PVBOXNETFLTINS pThis) +@@ -684,6 +760,7 @@ void vboxNetFltOsDeleteInstance(PVBOXNETFLTINS pThis) ng_rmnode_self(pThis->u.s.node); VBOXCURVNET_RESTORE(); pThis->u.s.node = NULL; @@ -189,7 +217,7 @@ } int vboxNetFltOsPreInitInstance(PVBOXNETFLTINS pThis) -@@ -697,6 +759,7 @@ int vboxNetFltOsPreInitInstance(PVBOXNETFLTINS pThis) +@@ -697,6 +774,7 @@ int vboxNetFltOsPreInitInstance(PVBOXNETFLTINS pThis) void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, bool fActive) { @@ -197,7 +225,7 @@ struct ifnet *ifp; struct ifreq ifreq; int error; -@@ -730,7 +793,10 @@ void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, b +@@ -730,7 +808,10 @@ void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, b NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_CONNECT, sizeof(struct ngm_connect), M_NOWAIT); if (msg == NULL) @@ -208,7 +236,7 @@ con = (struct ngm_connect *)msg->data; snprintf(con->path, NG_PATHSIZ, "vboxnetflt_%s:", ifp->if_xname); strlcpy(con->ourhook, "lower", NG_HOOKSIZ); -@@ -744,7 +810,10 @@ void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, b +@@ -744,7 +825,10 @@ void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, b NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_CONNECT, sizeof(struct ngm_connect), M_NOWAIT); if (msg == NULL) @@ -219,7 +247,7 @@ con = (struct ngm_connect *)msg->data; snprintf(con->path, NG_PATHSIZ, "vboxnetflt_%s:", ifp->if_xname); -@@ -767,7 +836,10 @@ void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, b +@@ -767,7 +851,10 @@ void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, b NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_RMHOOK, sizeof(struct ngm_rmhook), M_NOWAIT); if (msg == NULL) @@ -230,7 +258,7 @@ rm = (struct ngm_rmhook *)msg->data; strlcpy(rm->ourhook, "input", NG_HOOKSIZ); NG_SEND_MSG_PATH(error, node, msg, path, 0); -@@ -778,12 +850,16 @@ void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, b +@@ -778,12 +865,16 @@ void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, b NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_RMHOOK, sizeof(struct ngm_rmhook), M_NOWAIT); if (msg == NULL)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103181551.12IFp9GB022901>