virtualbox-modules: that work with kernel 5.5

This commit is contained in:
Rick Farina (Zero_Chaos) 2020-02-11 16:07:05 -05:00
parent e34839b720
commit 6d0cafa596
No known key found for this signature in database
GPG key ID: A29433C0AA431DDC
16 changed files with 902 additions and 0 deletions

View file

@ -0,0 +1,7 @@
DIST vbox-kernel-module-src-5.2.32.tar.xz 642428 BLAKE2B 0dda5cb5608c1eed22bea209564d53c5f7eab58ca620db2cc441e3c1ba9ad66609c4ef13df07fd29b691f2941a070f9852e8729cd386081df6a82ede345f33c5 SHA512 fadedab690cb7dee8b9a6747ed711d924bf3bce8999b24e7b64cb8738c53c2fa7372b1a8e8535e7e4ef0235aec02d4a3f1f67cd07d7621934fab684c5163329e
DIST vbox-kernel-module-src-5.2.34.tar.xz 642756 BLAKE2B 8a1dacc71b0c033130db84f46ab6029839e4c95cd20b6c982716fde9a83070f4597a9418ef2747c5b5714eafd5c1453c67eb1477104cd1185baf408301bc0226 SHA512 2feefa7867c664f1a1af04181e6db4cf2ab18e8a42dc57afe5fe13d35de889c2a88b79eb43642e024d99decfdd79c42891989158016edb09d5001783c4cb7ac3
DIST vbox-kernel-module-src-5.2.36.tar.xz 643160 BLAKE2B 50f1aee4d56c8b78a5e7512cb843b4e36137c38b160ca0419b2061892f29a98edaa266afb8f94ee0952e4c8af57b41da24a7d70b43a5adf5c5a15b2a4ac867b9 SHA512 b8aa3e8de1573ac728dc00d85ffbb0c25cdb118af92f16f7a4c1a7d394526b8f3005aab1b4422af6251bdafb958c6dc86b31f13c1f35116c8ff39a9288aed277
DIST vbox-kernel-module-src-6.0.14.tar.xz 669396 BLAKE2B e2dc77f33176af16be0fcad8851dd42eb2b7b21da35dc434951e3300e45fec4b516741f6122ae43aed2ee332323221098f047b5206ca63eb7741925a40682728 SHA512 1bcc78dff3305bb7186cec2a844188411a62fe32d0581c4de21843ee513925d5dfc9bd4dedb3cc90f0e1c165c7ae6d856590cc359e36cc8605b164c2c9979380
DIST vbox-kernel-module-src-6.0.16.tar.xz 669392 BLAKE2B 19e718097ee4da75c8dc3b565735f0a378d94547911ec89af52d8dccb36d67391a2f6700575c374552cd4fc4eb8a7e3d6618a800380e473429bd3759e0d1f9c0 SHA512 8979da4cba07c9095778864af0fd29c0acf10d71ea587819954a349e8c193a03b2268bf80dca9004803d8cf2a40974994fcd1f2c6e2ac657b5032f6c04977793
DIST vbox-kernel-module-src-6.1.0.tar.xz 664268 BLAKE2B 9007242bdfcc407283d183132867bef8cfcf75960e7032f1541be39e33c15de68ae1f49c0022422d776fe0397c1411c62866990efb55fe29f9dce27bf7b95b71 SHA512 a5b9f740589ca09b4115275e01d0da7d68535a927550a57007b75726c715422724593f4debc2a123fb8de43a27e49b372aba3832f17dda3ecfd8813d440a0cff
DIST vbox-kernel-module-src-6.1.2.tar.xz 664844 BLAKE2B 4fbdbac98558309c4dd1a25e44f061e2c7386c418f40b0da364914d58cf69048d9c3b1693fb75ce590c63280e79a124433ce7ff4f8f08e327ab67c5d55a163cf SHA512 f26e38a35b0cbf3ca51d98299ea2018641a35c17df5b1bc8a50352738afaafcc95efc9e61efc7d7406e203f3e514125b8afd8ed4406c190f82fe83934a042158

View file

@ -0,0 +1,29 @@
#!/bin/bash
# Create a virtualbox modules tarball from a VirtualBox binary package.
# We cannot download the package by this script because of the unpredictable
# build number being in the filename.
#
# usage: create_vbox_modules_tarball.sh VirtualBox-4.1.18-78361-Linux_amd64.run
[ -f "$1" ] || exit 1
VBOX_PACKAGE="$1"
VERSION_SUFFIX=""
if [[ ${VBOX_PACKAGE} = *_BETA* ]] || [[ ${VBOX_PACKAGE} = *_RC* ]] ; then
VERSION_SUFFIX="$(echo ${VBOX_PACKAGE} | sed 's@.*VirtualBox-[[:digit:]\.]\+\(_[[:alpha:]]\+[[:digit:]]\).*@\L\1@')"
fi
VBOX_VER="$(echo ${VBOX_PACKAGE} | sed 's@.*VirtualBox-\([[:digit:]\.]\+\).*@\1@')${VERSION_SUFFIX}"
sh ${VBOX_PACKAGE} --noexec --keep --nox11 || exit 2
cd install || exit 3
tar -xaf VirtualBox.tar.bz2 || exit 4
cd src/vboxhost || exit 5
tar -cvJf ../../../vbox-kernel-module-src-${VBOX_VER}.tar.xz . || exit 6
cd ../../.. && rm install -rf
exit 0

View file

@ -0,0 +1,44 @@
--- vboxdrv/SUPDrvIDC.h
+++ vboxdrv/SUPDrvIDC.h
@@ -160,7 +160,7 @@ typedef struct SUPDRVIDCREQGETSYM
{
/** The symbol address. */
PFNRT pfnSymbol;
- } Out;
+ } __no_const Out;
} u;
} SUPDRVIDCREQGETSYM;
/** Pointer to a SUPDRV IDC get symbol request. */
--- vboxnetflt/include/VBox/intnet.h
+++ vboxnetflt/include/VBox/intnet.h
@@ -783,7 +783,7 @@ typedef struct INTNETTRUNKFACTORY
DECLR0CALLBACKMEMBER(int, pfnCreateAndConnect,(struct INTNETTRUNKFACTORY *pIfFactory, const char *pszName,
PINTNETTRUNKSWPORT pSwitchPort, uint32_t fFlags,
PINTNETTRUNKIFPORT *ppIfPort));
-} INTNETTRUNKFACTORY;
+} __no_const INTNETTRUNKFACTORY;
/** Pointer to the trunk factory. */
typedef INTNETTRUNKFACTORY *PINTNETTRUNKFACTORY;
--- vboxnetflt/linux/VBoxNetFlt-linux.c
+++ vboxnetflt/linux/VBoxNetFlt-linux.c
@@ -840,7 +840,7 @@ typedef struct ethtool_ops OVR_OPSTYPE;
# else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) */
-typedef struct net_device_ops OVR_OPSTYPE;
+typedef net_device_ops_no_const OVR_OPSTYPE;
# define OVR_OPS netdev_ops
# define OVR_XMIT pOrgOps->ndo_start_xmit
--- vboxpci/include/VBox/rawpci.h
+++ vboxpci/include/VBox/rawpci.h
@@ -545,7 +545,7 @@ typedef struct RAWPCIFACTORY
DECLR0CALLBACKMEMBER(void, pfnDeinitVm,(PRAWPCIFACTORY pFactory,
PVM pVM,
PRAWPCIPERVM pVmData));
-} RAWPCIFACTORY;
+} __no_const RAWPCIFACTORY;
#define RAWPCIFACTORY_UUID_STR "ea089839-4171-476f-adfb-9e7ab1cbd0fb"

View file

@ -0,0 +1,76 @@
https://bugs.gentoo.org/694560
https://www.virtualbox.org/ticket/18911#comment:5
--- a/vboxnetflt//linux/VBoxNetFlt-linux.c
+++ b/vboxnetflt//linux/VBoxNetFlt-linux.c
@@ -2123,7 +2123,9 @@ static int vboxNetFltLinuxEnumeratorCallback(struct notifier_block *self, unsign
#endif
if (in_dev != NULL)
{
- for_ifa(in_dev) {
+ struct in_ifaddr *ifa;
+
+ for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
if (VBOX_IPV4_IS_LOOPBACK(ifa->ifa_address))
return NOTIFY_OK;
@@ -2137,7 +2139,7 @@ static int vboxNetFltLinuxEnumeratorCallback(struct notifier_block *self, unsign
pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort,
/* :fAdded */ true, kIntNetAddrType_IPv4, &ifa->ifa_address);
- } endfor_ifa(in_dev);
+ }
}
/*
--- a/vboxdrv/r0drv/linux/mp-r0drv-linux.c
+++ b/vboxdrv/r0drv/linux/mp-r0drv-linux.c
@@ -283,12 +283,15 @@ RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
if (RTCpuSetCount(&OnlineSet) > 1)
{
/* Fire the function on all other CPUs without waiting for completion. */
-# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)
+ smp_call_function(rtmpLinuxAllWrapper, &Args, 0 /* wait */);
+# elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
int rc = smp_call_function(rtmpLinuxAllWrapper, &Args, 0 /* wait */);
+ Assert(!rc); NOREF(rc);
# else
int rc = smp_call_function(rtmpLinuxAllWrapper, &Args, 0 /* retry */, 0 /* wait */);
-# endif
Assert(!rc); NOREF(rc);
+# endif
}
#endif
@@ -326,7 +329,6 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
{
#ifdef CONFIG_SMP
IPRT_LINUX_SAVE_EFL_AC();
- int rc;
RTMPARGS Args;
RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
@@ -337,14 +339,17 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
Args.cHits = 0;
RTThreadPreemptDisable(&PreemptState);
-# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
- rc = smp_call_function(rtmpLinuxWrapper, &Args, 1 /* wait */);
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)
+ smp_call_function(rtmpLinuxWrapper, &Args, 1 /* wait */);
+# elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
+ int rc = smp_call_function(rtmpLinuxWrapper, &Args, 1 /* wait */);
+ Assert(rc == 0); NOREF(rc);
# else /* older kernels */
- rc = smp_call_function(rtmpLinuxWrapper, &Args, 0 /* retry */, 1 /* wait */);
+ int rc = smp_call_function(rtmpLinuxWrapper, &Args, 0 /* retry */, 1 /* wait */);
+ Assert(rc == 0); NOREF(rc);
# endif /* older kernels */
RTThreadPreemptRestore(&PreemptState);
- Assert(rc == 0); NOREF(rc);
IPRT_LINUX_RESTORE_EFL_AC();
#else
RT_NOREF(pfnWorker, pvUser1, pvUser2);

View file

@ -0,0 +1,308 @@
https://www.virtualbox.org/changeset/81586/vbox
https://www.virtualbox.org/changeset/81587/vbox
https://www.virtualbox.org/changeset/81649/vbox (partially)
--- 6.0.14/vboxdrv/include/iprt/cdefs.h
+++ 6.0.14/vboxdrv/include/iprt/cdefs.h
@@ -1166,7 +1166,7 @@
* Tell the compiler that we're falling through to the next case in a switch.
* @sa RT_FALL_THRU */
#if RT_GNUC_PREREQ(7, 0)
-# define RT_FALL_THROUGH() __attribute__((fallthrough))
+# define RT_FALL_THROUGH() __attribute__((__fallthrough__))
#else
# define RT_FALL_THROUGH() (void)0
#endif
--- 6.0.14/vboxdrv/r0drv/linux/alloc-r0drv-linux.c
+++ 6.0.14/vboxdrv/r0drv/linux/alloc-r0drv-linux.c
@@ -443,9 +443,6 @@
}
SetPageReserved(&paPages[iPage]);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 20) /** @todo find the exact kernel where change_page_attr was introduced. */
- MY_SET_PAGES_EXEC(&paPages[iPage], 1);
-#endif
}
*pPhys = page_to_phys(paPages);
pvRet = phys_to_virt(page_to_phys(paPages));
@@ -491,9 +488,6 @@
for (iPage = 0; iPage < cPages; iPage++)
{
ClearPageReserved(&paPages[iPage]);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 20) /** @todo find the exact kernel where change_page_attr was introduced. */
- MY_SET_PAGES_NOEXEC(&paPages[iPage], 1);
-#endif
}
__free_pages(paPages, cOrder);
IPRT_LINUX_RESTORE_EFL_AC();
--- 6.0.14/vboxdrv/r0drv/linux/memobj-r0drv-linux.c
+++ 6.0.14/vboxdrv/r0drv/linux/memobj-r0drv-linux.c
@@ -86,6 +86,8 @@
/** Set if the allocation is contiguous.
* This means it has to be given back as one chunk. */
bool fContiguous;
+ /** Set if executable allocation. */
+ bool fExecutable;
/** Set if we've vmap'ed the memory into ring-0. */
bool fMappedToRing0;
/** The pages in the apPages array. */
@@ -289,10 +291,11 @@
* Only valid if fContiguous == true, ignored otherwise.
* @param fFlagsLnx The page allocation flags (GPFs).
* @param fContiguous Whether the allocation must be contiguous.
+ * @param fExecutable Whether the memory must be executable.
* @param rcNoMem What to return when we're out of pages.
*/
static int rtR0MemObjLinuxAllocPages(PRTR0MEMOBJLNX *ppMemLnx, RTR0MEMOBJTYPE enmType, size_t cb,
- size_t uAlignment, gfp_t fFlagsLnx, bool fContiguous, int rcNoMem)
+ size_t uAlignment, gfp_t fFlagsLnx, bool fContiguous, bool fExecutable, int rcNoMem)
{
size_t iPage;
size_t const cPages = cb >> PAGE_SHIFT;
@@ -371,7 +374,8 @@
for (iPage = 0; iPage < cPages; iPage++)
{
pMemLnx->apPages[iPage] = &paPages[iPage];
- MY_SET_PAGES_EXEC(pMemLnx->apPages[iPage], 1);
+ if (fExecutable)
+ MY_SET_PAGES_EXEC(pMemLnx->apPages[iPage], 1);
if (PageHighMem(pMemLnx->apPages[iPage]))
BUG();
}
@@ -379,6 +383,7 @@
fContiguous = true;
#endif /* < 2.4.22 */
pMemLnx->fContiguous = fContiguous;
+ pMemLnx->fExecutable = fExecutable;
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
/*
@@ -409,7 +414,7 @@
* This should never happen!
*/
printk("rtR0MemObjLinuxAllocPages(cb=0x%lx, uAlignment=0x%lx): alloc_pages(..., %d) returned physical memory at 0x%lx!\n",
- (unsigned long)cb, (unsigned long)uAlignment, rtR0MemObjLinuxOrder(cPages), (unsigned long)page_to_phys(pMemLnx->apPages[0]));
+ (unsigned long)cb, (unsigned long)uAlignment, rtR0MemObjLinuxOrder(cPages), (unsigned long)page_to_phys(pMemLnx->apPages[0]));
rtR0MemObjLinuxFreePages(pMemLnx);
return rcNoMem;
}
@@ -438,14 +443,12 @@
while (iPage-- > 0)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
- /*
- * See SetPageReserved() in rtR0MemObjLinuxAllocPages()
- */
+ /* See SetPageReserved() in rtR0MemObjLinuxAllocPages() */
ClearPageReserved(pMemLnx->apPages[iPage]);
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
-#else
- MY_SET_PAGES_NOEXEC(pMemLnx->apPages[iPage], 1);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 22)
+ if (pMemLnx->fExecutable)
+ MY_SET_PAGES_NOEXEC(pMemLnx->apPages[iPage], 1);
#endif
}
@@ -662,10 +665,10 @@
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, PAGE_SIZE, GFP_HIGHUSER,
- false /* non-contiguous */, VERR_NO_MEMORY);
+ false /* non-contiguous */, fExecutable, VERR_NO_MEMORY);
#else
rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, PAGE_SIZE, GFP_USER,
- false /* non-contiguous */, VERR_NO_MEMORY);
+ false /* non-contiguous */, fExecutable, VERR_NO_MEMORY);
#endif
if (RT_SUCCESS(rc))
{
@@ -696,19 +699,19 @@
#if (defined(RT_ARCH_AMD64) || defined(CONFIG_X86_PAE)) && defined(GFP_DMA32)
/* ZONE_DMA32: 0-4GB */
rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_DMA32,
- false /* non-contiguous */, VERR_NO_LOW_MEMORY);
+ false /* non-contiguous */, fExecutable, VERR_NO_LOW_MEMORY);
if (RT_FAILURE(rc))
#endif
#ifdef RT_ARCH_AMD64
/* ZONE_DMA: 0-16MB */
rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_DMA,
- false /* non-contiguous */, VERR_NO_LOW_MEMORY);
+ false /* non-contiguous */, fExecutable, VERR_NO_LOW_MEMORY);
#else
# ifdef CONFIG_X86_PAE
# endif
/* ZONE_NORMAL: 0-896MB */
rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_USER,
- false /* non-contiguous */, VERR_NO_LOW_MEMORY);
+ false /* non-contiguous */, fExecutable, VERR_NO_LOW_MEMORY);
#endif
if (RT_SUCCESS(rc))
{
@@ -738,17 +741,17 @@
#if (defined(RT_ARCH_AMD64) || defined(CONFIG_X86_PAE)) && defined(GFP_DMA32)
/* ZONE_DMA32: 0-4GB */
rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA32,
- true /* contiguous */, VERR_NO_CONT_MEMORY);
+ true /* contiguous */, fExecutable, VERR_NO_CONT_MEMORY);
if (RT_FAILURE(rc))
#endif
#ifdef RT_ARCH_AMD64
/* ZONE_DMA: 0-16MB */
rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA,
- true /* contiguous */, VERR_NO_CONT_MEMORY);
+ true /* contiguous */, fExecutable, VERR_NO_CONT_MEMORY);
#else
/* ZONE_NORMAL (32-bit hosts): 0-896MB */
rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_USER,
- true /* contiguous */, VERR_NO_CONT_MEMORY);
+ true /* contiguous */, fExecutable, VERR_NO_CONT_MEMORY);
#endif
if (RT_SUCCESS(rc))
{
@@ -795,7 +798,7 @@
rc = rtR0MemObjLinuxAllocPages(&pMemLnx, enmType, cb, uAlignment, fGfp,
enmType == RTR0MEMOBJTYPE_PHYS /* contiguous / non-contiguous */,
- VERR_NO_PHYS_MEMORY);
+ false /*fExecutable*/, VERR_NO_PHYS_MEMORY);
if (RT_FAILURE(rc))
return rc;
--- 6.0.14/vboxdrv/r0drv/linux/the-linux-kernel.h
+++ 6.0.14/vboxdrv/r0drv/linux/the-linux-kernel.h
@@ -337,8 +337,10 @@
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
-# define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages)
-# define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages)
+# if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0) /* The interface was removed, but we only need it for < 2.4.22, so who cares. */
+# define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages)
+# define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages)
+# endif
#else
# define MY_SET_PAGES_EXEC(pPages, cPages) \
do { \
--- 6.0.14/vboxdrv/r0drv/linux/thread2-r0drv-linux.c
+++ 6.0.14/vboxdrv/r0drv/linux/thread2-r0drv-linux.c
@@ -36,6 +36,9 @@
#include <iprt/errcore.h>
#include "internal/thread.h"
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+ #include <uapi/linux/sched/types.h>
+#endif /* >= KERNEL_VERSION(4, 11, 0) */
RTDECL(RTTHREAD) RTThreadSelf(void)
{
--- 6.0.14/vboxnetadp/include/iprt/cdefs.h
+++ 6.0.14/vboxnetadp/include/iprt/cdefs.h
@@ -1166,7 +1166,7 @@
* Tell the compiler that we're falling through to the next case in a switch.
* @sa RT_FALL_THRU */
#if RT_GNUC_PREREQ(7, 0)
-# define RT_FALL_THROUGH() __attribute__((fallthrough))
+# define RT_FALL_THROUGH() __attribute__((__fallthrough__))
#else
# define RT_FALL_THROUGH() (void)0
#endif
--- 6.0.14/vboxnetadp/r0drv/linux/the-linux-kernel.h
+++ 6.0.14/vboxnetadp/r0drv/linux/the-linux-kernel.h
@@ -337,8 +337,10 @@
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
-# define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages)
-# define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages)
+# if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0) /* The interface was removed, but we only need it for < 2.4.22, so who cares. */
+# define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages)
+# define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages)
+# endif
#else
# define MY_SET_PAGES_EXEC(pPages, cPages) \
do { \
--- 6.0.14/vboxnetflt/include/iprt/cdefs.h
+++ 6.0.14/vboxnetflt/include/iprt/cdefs.h
@@ -1166,7 +1166,7 @@
* Tell the compiler that we're falling through to the next case in a switch.
* @sa RT_FALL_THRU */
#if RT_GNUC_PREREQ(7, 0)
-# define RT_FALL_THROUGH() __attribute__((fallthrough))
+# define RT_FALL_THROUGH() __attribute__((__fallthrough__))
#else
# define RT_FALL_THROUGH() (void)0
#endif
--- 6.0.14/vboxnetflt/linux/VBoxNetFlt-linux.c
+++ 6.0.14/vboxnetflt/linux/VBoxNetFlt-linux.c
@@ -924,8 +924,13 @@
for (i = 0; i < skb_shinfo(pBuf)->nr_frags; i++)
{
skb_frag_t *pFrag = &skb_shinfo(pBuf)->frags[i];
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
+ pSG->aSegs[iSeg].cb = pFrag->bv_len;
+ pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->bv_offset;
+# else /* < KERNEL_VERSION(5, 4, 0) */
pSG->aSegs[iSeg].cb = pFrag->size;
pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->page_offset;
+# endif /* >= KERNEL_VERSION(5, 4, 0) */
Log6((" %p", pSG->aSegs[iSeg].pv));
pSG->aSegs[iSeg++].Phys = NIL_RTHCPHYS;
Assert(iSeg <= pSG->cSegsAlloc);
@@ -940,8 +945,13 @@
for (i = 0; i < skb_shinfo(pFragBuf)->nr_frags; i++)
{
skb_frag_t *pFrag = &skb_shinfo(pFragBuf)->frags[i];
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
+ pSG->aSegs[iSeg].cb = pFrag->bv_len;
+ pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->bv_offset;
+# else /* < KERNEL_VERSION(5, 4, 0) */
pSG->aSegs[iSeg].cb = pFrag->size;
pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->page_offset;
+# endif /* >= KERNEL_VERSION(5, 4, 0) */
Log6((" %p", pSG->aSegs[iSeg].pv));
pSG->aSegs[iSeg++].Phys = NIL_RTHCPHYS;
Assert(iSeg <= pSG->cSegsAlloc);
--- 6.0.14/vboxnetflt/r0drv/linux/the-linux-kernel.h
+++ 6.0.14/vboxnetflt/r0drv/linux/the-linux-kernel.h
@@ -337,8 +337,10 @@
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
-# define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages)
-# define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages)
+# if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0) /* The interface was removed, but we only need it for < 2.4.22, so who cares. */
+# define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages)
+# define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages)
+# endif
#else
# define MY_SET_PAGES_EXEC(pPages, cPages) \
do { \
--- 6.0.14/vboxpci/include/iprt/cdefs.h
+++ 6.0.14/vboxpci/include/iprt/cdefs.h
@@ -1166,7 +1166,7 @@
* Tell the compiler that we're falling through to the next case in a switch.
* @sa RT_FALL_THRU */
#if RT_GNUC_PREREQ(7, 0)
-# define RT_FALL_THROUGH() __attribute__((fallthrough))
+# define RT_FALL_THROUGH() __attribute__((__fallthrough__))
#else
# define RT_FALL_THROUGH() (void)0
#endif
--- 6.0.14/vboxpci/r0drv/linux/the-linux-kernel.h
+++ 6.0.14/vboxpci/r0drv/linux/the-linux-kernel.h
@@ -337,8 +337,10 @@
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
-# define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages)
-# define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages)
+# if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0) /* The interface was removed, but we only need it for < 2.4.22, so who cares. */
+# define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages)
+# define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages)
+# endif
#else
# define MY_SET_PAGES_EXEC(pPages, cPages) \
do { \

View file

@ -0,0 +1,35 @@
diff -Naur work-orig/Makefile work/Makefile
--- work-orig/Makefile 2020-02-11 15:59:19.397376547 -0500
+++ work/Makefile 2020-02-11 16:02:15.788370676 -0500
@@ -64,6 +64,7 @@
if [ -f vboxdrv/Module.symvers ]; then \
cp vboxdrv/Module.symvers vboxnetflt; \
fi; \
+ export KBUILD_EXTRA_SYMBOLS=${PWD}/vboxnetflt/Module.symvers; \
echo "=== Building 'vboxnetflt' module ==="; \
$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetflt || exit 1; \
cp vboxnetflt/vboxnetflt.ko .; \
@@ -75,6 +76,7 @@
if [ -f vboxdrv/Module.symvers ]; then \
cp vboxdrv/Module.symvers vboxnetadp; \
fi; \
+ export KBUILD_EXTRA_SYMBOLS=${PWD}/vboxnetadp/Module.symvers; \
echo "=== Building 'vboxnetadp' module ==="; \
$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetadp || exit 1; \
cp vboxnetadp/vboxnetadp.ko .; \
@@ -95,12 +97,15 @@
install:
@$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxdrv install
@if [ -d vboxnetflt ]; then \
+ export KBUILD_EXTRA_SYMBOLS=${PWD}/vboxnetflt/Module.symvers; \
$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetflt install; \
fi
@if [ -d vboxnetadp ]; then \
+ export KBUILD_EXTRA_SYMBOLS=${PWD}/vboxnetadp/Module.symvers; \
$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxnetadp install; \
fi
@if [ -d vboxpci ]; then \
+ export KBUILD_EXTRA_SYMBOLS=${PWD}/vboxpci/Module.symvers; \
$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C vboxpci install; \
fi

View file

@ -0,0 +1,4 @@
vboxdrv
vboxnetflt
vboxnetadp
vboxpci

View file

@ -0,0 +1,3 @@
vboxdrv
vboxnetflt
vboxnetadp

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>polynomial-c@gentoo.org</email>
<name>Lars Wendler</name>
</maintainer>
<use>
<flag name="pax_kernel">Apply patch needed for pax enabled kernels</flag>
</use>
</pkgmetadata>

View file

@ -0,0 +1,51 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# XXX: the tarball here is just the kernel modules split out of the binary
# package that comes from virtualbox-bin
EAPI=7
inherit linux-mod user
MY_P="vbox-kernel-module-src-${PV}"
DESCRIPTION="Kernel Modules for Virtualbox"
HOMEPAGE="https://www.virtualbox.org/"
SRC_URI="https://dev.gentoo.org/~polynomial-c/virtualbox/${MY_P}.tar.xz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="pax_kernel"
RDEPEND="!=app-emulation/virtualbox-9999"
S="${WORKDIR}"
BUILD_TARGETS="all"
BUILD_TARGET_ARCH="${ARCH}"
MODULE_NAMES="vboxdrv(misc:${S}) vboxnetflt(misc:${S}) vboxnetadp(misc:${S}) vboxpci(misc:${S})"
pkg_setup() {
enewgroup vboxusers
linux-mod_pkg_setup
BUILD_PARAMS="CC=$(tc-getBUILD_CC) KERN_DIR=${KV_DIR} KERN_VER=${KV_FULL} O=${KV_OUT_DIR} V=1 KBUILD_VERBOSE=1"
}
src_prepare() {
if use pax_kernel && kernel_is -ge 3 0 0 ; then
eapply -p0 "${FILESDIR}"/${PN}-5.2.8-pax-const.patch
fi
default
}
src_install() {
linux-mod_src_install
insinto /usr/lib/modules-load.d/
doins "${FILESDIR}"/virtualbox.conf
}
pkg_postinst() {
linux-mod_pkg_postinst
}

View file

@ -0,0 +1,51 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# XXX: the tarball here is just the kernel modules split out of the binary
# package that comes from virtualbox-bin
EAPI=7
inherit linux-mod user
MY_P="vbox-kernel-module-src-${PV}"
DESCRIPTION="Kernel Modules for Virtualbox"
HOMEPAGE="https://www.virtualbox.org/"
SRC_URI="https://dev.gentoo.org/~polynomial-c/virtualbox/${MY_P}.tar.xz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="pax_kernel"
RDEPEND="!=app-emulation/virtualbox-9999"
S="${WORKDIR}"
BUILD_TARGETS="all"
BUILD_TARGET_ARCH="${ARCH}"
MODULE_NAMES="vboxdrv(misc:${S}) vboxnetflt(misc:${S}) vboxnetadp(misc:${S}) vboxpci(misc:${S})"
pkg_setup() {
enewgroup vboxusers
linux-mod_pkg_setup
BUILD_PARAMS="CC=$(tc-getBUILD_CC) KERN_DIR=${KV_DIR} KERN_VER=${KV_FULL} O=${KV_OUT_DIR} V=1 KBUILD_VERBOSE=1"
}
src_prepare() {
if use pax_kernel && kernel_is -ge 3 0 0 ; then
eapply -p0 "${FILESDIR}"/${PN}-5.2.8-pax-const.patch
fi
default
}
src_install() {
linux-mod_src_install
insinto /usr/lib/modules-load.d/
doins "${FILESDIR}"/virtualbox.conf
}
pkg_postinst() {
linux-mod_pkg_postinst
}

View file

@ -0,0 +1,59 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# XXX: the tarball here is just the kernel modules split out of the binary
# package that comes from virtualbox-bin
EAPI=7
inherit linux-mod user
MY_P="vbox-kernel-module-src-${PV}"
DESCRIPTION="Kernel Modules for Virtualbox"
HOMEPAGE="https://www.virtualbox.org/"
SRC_URI="https://dev.gentoo.org/~polynomial-c/virtualbox/${MY_P}.tar.xz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="pax_kernel"
RDEPEND="!=app-emulation/virtualbox-9999"
S="${WORKDIR}"
BUILD_TARGETS="all"
MODULE_NAMES="vboxdrv(misc:${S}) vboxnetflt(misc:${S}) vboxnetadp(misc:${S}) vboxpci(misc:${S})"
MODULESD_VBOXDRV_ENABLED="yes"
MODULESD_VBOXNETADP_ENABLED="no"
MODULESD_VBOXNETFLT_ENABLED="no"
# The following is a security measure that comes directly from usptream.
# Do NOT remove this!!!
MODULESD_VBOXPCI_ADDITIONS=(
"blacklist vboxpci"
"install vboxpci /bin/true"
)
pkg_setup() {
enewgroup vboxusers
linux-mod_pkg_setup
BUILD_PARAMS="CC=$(tc-getBUILD_CC) KERN_DIR=${KV_DIR} KERN_VER=${KV_FULL} O=${KV_OUT_DIR} V=1 KBUILD_VERBOSE=1"
}
src_prepare() {
if use pax_kernel && kernel_is -ge 3 0 0 ; then
eapply -p0 "${FILESDIR}"/${PN}-5.2.8-pax-const.patch
fi
default
}
src_install() {
linux-mod_src_install
insinto /usr/lib/modules-load.d/
newins "${FILESDIR}"/virtualbox.conf-r1 virtualbox.conf
}
pkg_postinst() {
linux-mod_pkg_postinst
}

View file

@ -0,0 +1,56 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# XXX: the tarball here is just the kernel modules split out of the binary
# package that comes from virtualbox-bin
EAPI=7
inherit linux-mod user
MY_P="vbox-kernel-module-src-${PV}"
DESCRIPTION="Kernel Modules for Virtualbox"
HOMEPAGE="https://www.virtualbox.org/"
SRC_URI="https://dev.gentoo.org/~polynomial-c/virtualbox/${MY_P}.tar.xz"
LICENSE="GPL-2"
SLOT="0"
[[ "${PV}" == *_beta* ]] || [[ "${PV}" == *_rc* ]] || \
KEYWORDS="~amd64 ~x86"
IUSE="pax_kernel"
RDEPEND="!=app-emulation/virtualbox-9999"
S="${WORKDIR}"
BUILD_TARGETS="all"
BUILD_TARGET_ARCH="${ARCH}"
MODULE_NAMES="vboxdrv(misc:${S}) vboxnetflt(misc:${S}) vboxnetadp(misc:${S}) vboxpci(misc:${S})"
PATCHES=(
"${FILESDIR}/${P}-kernel-5.4_rc6.patch"
)
pkg_setup() {
enewgroup vboxusers
linux-mod_pkg_setup
BUILD_PARAMS="CC=$(tc-getBUILD_CC) KERN_DIR=${KV_DIR} KERN_VER=${KV_FULL} O=${KV_OUT_DIR} V=1 KBUILD_VERBOSE=1"
}
src_prepare() {
if use pax_kernel && kernel_is -ge 3 0 0 ; then
eapply -p0 "${FILESDIR}"/${PN}-5.2.8-pax-const.patch
fi
default
}
src_install() {
linux-mod_src_install
insinto /usr/lib/modules-load.d/
doins "${FILESDIR}"/virtualbox.conf
}
pkg_postinst() {
linux-mod_pkg_postinst
}

View file

@ -0,0 +1,56 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# XXX: the tarball here is just the kernel modules split out of the binary
# package that comes from virtualbox-bin
EAPI=7
inherit linux-mod user
MY_P="vbox-kernel-module-src-${PV}"
DESCRIPTION="Kernel Modules for Virtualbox"
HOMEPAGE="https://www.virtualbox.org/"
SRC_URI="https://dev.gentoo.org/~polynomial-c/virtualbox/${MY_P}.tar.xz"
LICENSE="GPL-2"
SLOT="0"
[[ "${PV}" == *_beta* ]] || [[ "${PV}" == *_rc* ]] || \
KEYWORDS="~amd64 ~x86"
IUSE="pax_kernel"
RDEPEND="!=app-emulation/virtualbox-9999"
S="${WORKDIR}"
BUILD_TARGETS="all"
MODULE_NAMES="vboxdrv(misc:${S}) vboxnetflt(misc:${S}) vboxnetadp(misc:${S}) vboxpci(misc:${S})"
MODULESD_VBOXDRV_ENABLED="yes"
MODULESD_VBOXNETADP_ENABLED="no"
MODULESD_VBOXNETFLT_ENABLED="no"
# The following is a security measure that comes directly from usptream.
# Do NOT remove this!!!
MODULESD_VBOXPCI_ADDITIONS=(
"blacklist vboxpci"
"install vboxpci /bin/true"
)
pkg_setup() {
enewgroup vboxusers
linux-mod_pkg_setup
BUILD_PARAMS="CC=$(tc-getBUILD_CC) KERN_DIR=${KV_DIR} KERN_VER=${KV_FULL} O=${KV_OUT_DIR} V=1 KBUILD_VERBOSE=1"
}
src_prepare() {
if use pax_kernel && kernel_is -ge 3 0 0 ; then
eapply -p0 "${FILESDIR}"/${PN}-5.2.8-pax-const.patch
fi
default
}
src_install() {
linux-mod_src_install
insinto /usr/lib/modules-load.d/
newins "${FILESDIR}"/virtualbox.conf-r1 virtualbox.conf
}

View file

@ -0,0 +1,54 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# XXX: the tarball here is just the kernel modules split out of the binary
# package that comes from virtualbox-bin
EAPI=7
inherit linux-mod user
MY_P="vbox-kernel-module-src-${PV}"
DESCRIPTION="Kernel Modules for Virtualbox"
HOMEPAGE="https://www.virtualbox.org/"
SRC_URI="https://dev.gentoo.org/~polynomial-c/virtualbox/${MY_P}.tar.xz"
LICENSE="GPL-2"
SLOT="0"
[[ "${PV}" == *_beta* ]] || [[ "${PV}" == *_rc* ]] || \
KEYWORDS="~amd64"
IUSE="pax_kernel"
RDEPEND="!=app-emulation/virtualbox-9999"
S="${WORKDIR}"
BUILD_TARGETS="all"
BUILD_TARGET_ARCH="${ARCH}"
MODULE_NAMES="vboxdrv(misc:${S}) vboxnetflt(misc:${S}) vboxnetadp(misc:${S})"
pkg_setup() {
enewgroup vboxusers
linux-mod_pkg_setup
BUILD_PARAMS="CC=$(tc-getBUILD_CC) KERN_DIR=${KV_DIR} KERN_VER=${KV_FULL} O=${KV_OUT_DIR} V=1 KBUILD_VERBOSE=1"
}
src_prepare() {
if use pax_kernel && kernel_is -ge 3 0 0 ; then
eapply -p0 "${FILESDIR}"/${PN}-5.2.8-pax-const.patch
fi
default
}
src_install() {
linux-mod_src_install
insinto /usr/lib/modules-load.d/
newins "${FILESDIR}"/virtualbox.conf-r1 virtualbox.conf
}
pkg_postinst() {
# Remove vboxpci.ko from current running kernel
find /lib/modules/${KV_FULL}/misc -type f -name "vboxpci.ko" -delete || die
linux-mod_pkg_postinst
}

View file

@ -0,0 +1,57 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# XXX: the tarball here is just the kernel modules split out of the binary
# package that comes from virtualbox-bin
EAPI=7
inherit linux-mod user
MY_P="vbox-kernel-module-src-${PV}"
DESCRIPTION="Kernel Modules for Virtualbox"
HOMEPAGE="https://www.virtualbox.org/"
SRC_URI="https://dev.gentoo.org/~polynomial-c/virtualbox/${MY_P}.tar.xz"
LICENSE="GPL-2"
SLOT="0"
[[ "${PV}" == *_beta* ]] || [[ "${PV}" == *_rc* ]] || \
KEYWORDS="~amd64"
IUSE="pax_kernel"
RDEPEND="!=app-emulation/virtualbox-9999"
S="${WORKDIR}"
BUILD_TARGETS="all"
MODULE_NAMES="vboxdrv(misc:${S}) vboxnetflt(misc:${S}) vboxnetadp(misc:${S})"
MODULESD_VBOXDRV_ENABLED="yes"
MODULESD_VBOXNETADP_ENABLED="no"
MODULESD_VBOXNETFLT_ENABLED="no"
pkg_setup() {
enewgroup vboxusers
linux-mod_pkg_setup
BUILD_PARAMS="CC=$(tc-getBUILD_CC) KERN_DIR=${KV_DIR} KERN_VER=${KV_FULL} O=${KV_OUT_DIR} V=1 KBUILD_VERBOSE=1"
}
src_prepare() {
if use pax_kernel && kernel_is -ge 3 0 0 ; then
eapply -p0 "${FILESDIR}"/${PN}-5.2.8-pax-const.patch
fi
eapply "${FILESDIR}/${P}-kernel-5.5.patch"
default
}
src_install() {
linux-mod_src_install
insinto /usr/lib/modules-load.d/
newins "${FILESDIR}"/virtualbox.conf-r1 virtualbox.conf
}
pkg_postinst() {
# Remove vboxpci.ko from current running kernel
find /lib/modules/${KV_FULL}/misc -type f -name "vboxpci.ko" -delete
linux-mod_pkg_postinst
}