summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Bermond2019-12-03 01:32:53 +0000
committerDaniel Bermond2019-12-03 01:32:53 +0000
commitfe572a9c209f8a979a99ea2ff5fe3850a6525423 (patch)
tree82fb4d6ee47bdf643c3d8d562853d34f4c4a6da8
parentdbac723c01bbb4cc88555c4c3872a228977a1a6d (diff)
downloadaur-fe572a9c209f8a979a99ea2ff5fe3850a6525423.tar.gz
Add fix for linux 5.4
-rw-r--r--.SRCINFO4
-rw-r--r--016-linux-5-4.patch272
-rw-r--r--PKGBUILD9
3 files changed, 281 insertions, 4 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 4a739ea3609a..8275a3a4f189 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = virtualbox-bin
pkgdesc = Oracle VM VirtualBox Binary Edition (Oracle branded non-OSE version)
pkgver = 6.0.14
- pkgrel = 1
+ pkgrel = 2
url = https://www.virtualbox.org/
install = virtualbox-bin.install
arch = x86_64
@@ -48,6 +48,7 @@ pkgbase = virtualbox-bin
source = do_dkms
source = dkms.conf
source = 013-Makefile.patch
+ source = 016-linux-5-4.patch
sha256sums = e6a63037caf3bc5ced1bb384b2a7fcf86b9fca5a467101ece4c5f7bf38edc4fe
sha256sums = c7b848034939fa65be095752109009ad0c3733e5d10c09fd26b5addaf58ba159
sha256sums = 584f02a2a1e83b9cabd7b7e3b00a0515b118e040160eb46c014ea6fd3a16586e
@@ -60,6 +61,7 @@ pkgbase = virtualbox-bin
sha256sums = cc1c0500ab07bc13563d99037f776bf64bdc90bb521e31e2e0b04e42ea5bb36a
sha256sums = e9df0fff15184d0a90abe17707bdbe1931582433bbc14ded4fb3b0252653c801
sha256sums = 268e794de9d66a2751006b2ca3810fc6a05da4af2ffa8b58c56c94b292f1f424
+ sha256sums = 25ab9f415130a53d2fc879e0cdfc5848e36f8077d24bce67f962ec913bcb63b2
pkgname = virtualbox-bin
diff --git a/016-linux-5-4.patch b/016-linux-5-4.patch
new file mode 100644
index 000000000000..e29f715b7f9c
--- /dev/null
+++ b/016-linux-5-4.patch
@@ -0,0 +1,272 @@
+https://www.virtualbox.org/changeset/81586/vbox
+https://www.virtualbox.org/changeset/81587/vbox
+https://www.virtualbox.org/changeset/81649/vbox
+
+diff -u -r a/src/vboxhost/vboxdrv/include/iprt/cdefs.h b/src/vboxhost/vboxdrv/include/iprt/cdefs.h
+--- a/src/vboxhost/vboxdrv/include/iprt/cdefs.h 2019-10-10 18:25:42.000000000 +0000
++++ b/src/vboxhost/vboxdrv/include/iprt/cdefs.h 2019-11-26 10:08:56.314644140 +0000
+@@ -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
+diff -u -r a/src/vboxhost/vboxnetadp/include/iprt/cdefs.h b/src/vboxhost/vboxnetadp/include/iprt/cdefs.h
+--- a/src/vboxhost/vboxnetadp/include/iprt/cdefs.h 2019-10-10 18:25:42.000000000 +0000
++++ b/src/vboxhost/vboxnetadp/include/iprt/cdefs.h 2019-11-26 10:08:56.314644140 +0000
+@@ -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
+diff -u -r a/src/vboxhost/vboxnetflt/include/iprt/cdefs.h b/src/vboxhost/vboxnetflt/include/iprt/cdefs.h
+--- a/src/vboxhost/vboxnetflt/include/iprt/cdefs.h 2019-10-10 18:25:42.000000000 +0000
++++ b/src/vboxhost/vboxnetflt/include/iprt/cdefs.h 2019-11-26 10:08:56.314644140 +0000
+@@ -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
+diff -u -r a/src/vboxhost/vboxpci/include/iprt/cdefs.h b/src/vboxhost/vboxpci/include/iprt/cdefs.h
+--- a/src/vboxhost/vboxpci/include/iprt/cdefs.h 2019-10-10 18:25:42.000000000 +0000
++++ b/src/vboxhost/vboxpci/include/iprt/cdefs.h 2019-11-26 10:08:56.314644140 +0000
+@@ -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
+diff -u -r a/src/vboxhost/vboxnetflt/linux/VBoxNetFlt-linux.c b/src/vboxhost/vboxnetflt/linux/VBoxNetFlt-linux.c
+--- a/src/vboxhost/vboxnetflt/linux/VBoxNetFlt-linux.c 2019-10-10 18:35:33.000000000 +0000
++++ b/src/vboxhost/vboxnetflt/linux/VBoxNetFlt-linux.c 2019-11-26 10:08:56.321310893 +0000
+@@ -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);
+diff -u -r a/src/vboxhost/vboxdrv/r0drv/linux/alloc-r0drv-linux.c b/src/vboxhost/vboxdrv/r0drv/linux/alloc-r0drv-linux.c
+--- a/src/vboxhost/vboxdrv/r0drv/linux/alloc-r0drv-linux.c 2019-10-10 18:36:16.000000000 +0000
++++ b/src/vboxhost/vboxdrv/r0drv/linux/alloc-r0drv-linux.c 2019-11-26 10:24:51.692930759 +0000
+@@ -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();
+diff -u -r a/src/vboxhost/vboxdrv/r0drv/linux/memobj-r0drv-linux.c b/src/vboxhost/vboxdrv/r0drv/linux/memobj-r0drv-linux.c
+--- a/src/vboxhost/vboxdrv/r0drv/linux/memobj-r0drv-linux.c 2019-10-10 18:36:16.000000000 +0000
++++ b/src/vboxhost/vboxdrv/r0drv/linux/memobj-r0drv-linux.c 2019-11-26 10:09:28.805069152 +0000
+@@ -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;
+
+diff -u -r a/src/vboxhost/vboxdrv/r0drv/linux/the-linux-kernel.h b/src/vboxhost/vboxdrv/r0drv/linux/the-linux-kernel.h
+--- a/src/vboxhost/vboxdrv/r0drv/linux/the-linux-kernel.h 2019-10-10 18:36:16.000000000 +0000
++++ b/src/vboxhost/vboxdrv/r0drv/linux/the-linux-kernel.h 2019-11-26 10:09:39.218538652 +0000
+@@ -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 { \
+diff -u -r a/src/vboxhost/vboxdrv/r0drv/linux/thread2-r0drv-linux.c b/src/vboxhost/vboxdrv/r0drv/linux/thread2-r0drv-linux.c
+--- a/src/vboxhost/vboxdrv/r0drv/linux/thread2-r0drv-linux.c 2019-10-10 18:36:16.000000000 +0000
++++ b/src/vboxhost/vboxdrv/r0drv/linux/thread2-r0drv-linux.c 2019-11-26 10:08:56.321310893 +0000
+@@ -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)
+ {
diff --git a/PKGBUILD b/PKGBUILD
index 15444370c9c6..cc111eac3600 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -8,7 +8,7 @@ pkgname=virtualbox-bin
pkgver=6.0.14
_build=133895
_rev=79806
-pkgrel=1
+pkgrel=2
pkgdesc='Oracle VM VirtualBox Binary Edition (Oracle branded non-OSE version)'
arch=('x86_64')
url='https://www.virtualbox.org/'
@@ -37,7 +37,8 @@ source=("http://download.virtualbox.org/virtualbox/${pkgver}/VirtualBox-${pkgver
'vboxweb.conf'
'do_dkms'
'dkms.conf'
- '013-Makefile.patch')
+ '013-Makefile.patch'
+ '016-linux-5-4.patch')
noextract=("VirtualBoxSDK-${pkgver}-${_build}.zip")
sha256sums=('e6a63037caf3bc5ced1bb384b2a7fcf86b9fca5a467101ece4c5f7bf38edc4fe'
'c7b848034939fa65be095752109009ad0c3733e5d10c09fd26b5addaf58ba159'
@@ -50,7 +51,8 @@ sha256sums=('e6a63037caf3bc5ced1bb384b2a7fcf86b9fca5a467101ece4c5f7bf38edc4fe'
'12dbba3b59991f2b68cddeeeda20236aeff63e11b7e2d1b08d9d6a82225f6651'
'cc1c0500ab07bc13563d99037f776bf64bdc90bb521e31e2e0b04e42ea5bb36a'
'e9df0fff15184d0a90abe17707bdbe1931582433bbc14ded4fb3b0252653c801'
- '268e794de9d66a2751006b2ca3810fc6a05da4af2ffa8b58c56c94b292f1f424')
+ '268e794de9d66a2751006b2ca3810fc6a05da4af2ffa8b58c56c94b292f1f424'
+ '25ab9f415130a53d2fc879e0cdfc5848e36f8077d24bce67f962ec913bcb63b2')
prepare() {
mkdir -p "${pkgname}-${pkgver}"
@@ -79,6 +81,7 @@ package() {
printf '%s\n' " -> Fixing DKMS build..."
cd "${pkgdir}/${_installdir}"
patch -Np1 -i "${srcdir}/013-Makefile.patch"
+ patch -Np1 -i "${srcdir}/016-linux-5-4.patch"
# hardened build: mark binaries suid root, and make sure the
# directory is only writable by the user